本文整理汇总了PHP中JApplication类的典型用法代码示例。如果您正苦于以下问题:PHP JApplication类的具体用法?PHP JApplication怎么用?PHP JApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testIsSSLConnection
/**
* Test JApplication::isSSLConnection
*
* @return void
*/
public function testIsSSLConnection()
{
unset($_SERVER['HTTPS']);
$this->assertThat($this->object->isSSLConnection(), $this->equalTo(false));
$_SERVER['HTTPS'] = 'on';
$this->assertThat($this->object->isSSLConnection(), $this->equalTo(true));
}
开发者ID:SysBind,项目名称:joomla-cms,代码行数:12,代码来源:JApplicationTest.php
示例2: checkPermission
function checkPermission($function)
{
$c = jomtube_configs::get_instance();
$user =& JFactory::getUser();
if ($user->gid < $c->{$function} && $c->{$function} != 29) {
// Redirect to login
$uri = JFactory::getURI();
$return = $uri->toString();
$url = 'index.php?option=com_user&view=login';
$url .= '&return=' . base64_encode($return);
$r = new JApplication();
$r->redirect($url, JText::_('You do not have permission to upload videos'));
return;
}
}
开发者ID:plexicloud,项目名称:Plexicloud-Pleximedia,代码行数:15,代码来源:mix.php
示例3: display
public function display()
{
$portal = $this->getModel()->getItem();
header('X-Portal-ID: ' . $portal->id);
$doc =& JFactory::getDocument();
if ($portal->title) {
$doc->setTitle($portal->title);
}
if ($portal->meta_keywords) {
$doc->setMetaData('Keywords', $portal->meta_keywords);
}
if ($portal->meta_description) {
$doc->setMetaData('Description', $portal->meta_description);
}
//TODO: Check if itemId
$pathway = JFactory::getApplication()->getPathway();
if (!JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_portals&view=portal&id=' . $portal->id, true)) {
$category = $this->getService('com://site/portals.model.categories')->id($portal->portals_category_id)->getItem();
if ($category->id) {
$item = JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_portals&view=category&id=' . $category->id, true);
if ($item) {
$i = 0;
foreach (explode('/', $item->route) as $part) {
$pathway->addItem(ucfirst($part), 'index.php?Itemid=' . $item->tree[$i]);
$i++;
}
}
$pathway->addItem($portal->title);
}
}
return parent::display();
}
开发者ID:kedweber,项目名称:com_portals,代码行数:32,代码来源:html.php
示例4: prepareDisplay
protected function prepareDisplay($preconfig)
{
if (JCck::getConfig_Param('debug', 0)) {
jimport('joomla.error.profiler');
$profiler = new JProfiler();
}
$app = JFactory::getApplication();
$this->form = $this->get('Form');
$this->option = $app->input->get('option', '');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$option = $this->option;
$params = new JRegistry();
$view = $this->getName();
$isNew = 1;
$live = '';
$lives = array();
$variation = '';
jimport('cck.base.form.form');
include_once JPATH_LIBRARIES_CCK . '/base/form/form_inc.php';
if (isset($config['id'])) {
JFactory::getSession()->set('cck_hash_seblod_form', JApplication::getHash($id . '|' . $type->name . '|' . $config['id']));
}
$this->config =& $config;
$this->data =& $data;
$this->id =& $id;
$this->isNew =& $isNew;
$this->params =& $params;
$this->stage =& $stage;
$this->type =& $type;
$title = isset($type->title) ? $type->title : '';
$name = isset($type->name) ? $type->name : '';
$this->addToolbar($title, $name);
}
开发者ID:densem-2013,项目名称:exikom,代码行数:34,代码来源:view.html.php
示例5: prepareTable
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = JFactory::getDate();
$user = JFactory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = JApplication::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = JApplication::stringURLSafe($table->title);
}
if (intval($table->date) == 0) {
$table->date = JFactory::getDate()->toSql();
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = JFactory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_comments WHERE catid = ' . (int) $table->catid);
$max = $db->loadResult();
$table->ordering = $max + 1;
}
} else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
开发者ID:scarsroga,项目名称:blog-soa,代码行数:29,代码来源:phocagalleryco.php
示例6: store
public function store($updateNulls = false)
{
$isNew = false;
if (!$this->id) {
// New document
$this->downloaded = 0;
$isNew = true;
}
if (isset($this->alias) && isset($this->name) && $this->alias == "") {
$this->alias = preg_replace("/ /", "-", strtolower($this->name));
}
if (version_compare(JVERSION, '3.0', '>=')) {
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
} else {
$this->alias = JApplication::stringURLSafe($this->alias);
}
// Trigger events to osdownloads plugins
$dispatcher = $this->getDispatcher();
$pluginResults = $dispatcher->trigger('onOSDownloadsBeforeSaveFile', array(&$this, $isNew));
$result = false;
if ($pluginResults !== false) {
$result = parent::store($updateNulls);
$dispatcher->trigger('onOSDownloadsAfterSaveFile', array($result, &$this));
}
return $result;
}
开发者ID:patricmutwiri,项目名称:OSDownloads-1,代码行数:26,代码来源:abstractdocument.php
示例7: check
/**
* Overloaded check function
*
* @return boolean True on success
*
* @see JTable::check
* @since 11.1
*/
public function check()
{
// If the alias field is empty, set it to the title.
$this->alias = trim($this->alias);
if (empty($this->alias) && ($this->type != 'alias' && $this->type != 'url')) {
$this->alias = $this->title;
}
// Make the alias URL safe.
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '') {
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
}
// Cast the home property to an int for checking.
$this->home = (int) $this->home;
// Verify that a first level menu item alias is not 'component'.
if ($this->parent_id == 1 && $this->alias == 'component') {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT'));
return false;
}
// Verify that a first level menu item alias is not the name of a folder.
jimport('joomla.filesystem.folder');
if ($this->parent_id == 1 && in_array($this->alias, JFolder::folders(JPATH_ROOT))) {
$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER', $this->alias, $this->alias));
return false;
}
// Verify that the home item a component.
if ($this->home && $this->type != 'component') {
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT'));
return false;
}
return true;
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:40,代码来源:menu.php
示例8: _findItemId
protected static function _findItemId($needles)
{
// Prepare the reverse lookup array.
if (self::$lookup === null) {
self::$lookup = array();
$component =& JComponentHelper::getComponent('com_xmap');
$menus =& JApplication::getMenu('site', array());
$items = $menus->getItems('component_id', $component->id);
foreach ($items as &$item) {
if (isset($item->query) && isset($item->query['view'])) {
$view = $item->query['view'];
if (!isset(self::$lookup[$view])) {
self::$lookup[$view] = array();
}
if (isset($item->query['id'])) {
self::$lookup[$view][$item->query['id']] = $item->id;
}
}
}
}
$match = null;
foreach ($needles as $view => $id) {
if (isset(self::$lookup[$view])) {
if (isset(self::$lookup[$view][$id])) {
return self::$lookup[$view][$id];
}
}
}
return null;
}
开发者ID:educakanchay,项目名称:educared,代码行数:30,代码来源:router.php
示例9: store
public function store($updateNulls = false)
{
if (isset($this->alias)) {
$this->alias = JApplication::stringURLSafe($this->alias);
}
if (!empty($this->metakey)) {
// Only process if not empty
$bad_characters = array("\n", "\r", "\"", "<", ">");
// array of characters to remove
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
// remove bad characters
$keys = explode(',', $after_clean);
// create array using commas as delimiter
$clean_keys = array();
foreach ($keys as $key) {
if (trim($key)) {
// Ignore blank keywords
$clean_keys[] = trim($key);
}
}
$this->metakey = implode(", ", $clean_keys);
// put array back together delimited by ", "
}
if (empty($this->answer_created_by_id)) {
$this->answer_created_by_id = JFactory::getUser()->id;
}
return parent::store($updateNulls);
}
开发者ID:ASDAFF,项目名称:smfaq,代码行数:28,代码来源:smfaq.php
示例10: createNewUser
public function createNewUser($params)
{
$user = new JUser(0);
JLoader::import('joomla.application.component.helper');
$usersConfig = JComponentHelper::getParams('com_users');
$newUsertype = $usersConfig->get('new_usertype');
// get the New User Group from com_users' settings
if (empty($newUsertype)) {
$newUsertype = 2;
}
$params['groups'] = array($newUsertype);
$params['sendEmail'] = 0;
// Set the user's default language to whatever the site's current language is
if (version_compare(JVERSION, '3.0', 'ge')) {
$params['params'] = array('language' => JFactory::getConfig()->get('language'));
} else {
$params['params'] = array('language' => JFactory::getConfig()->getValue('config.language'));
}
JLoader::import('joomla.user.helper');
$params['block'] = 0;
$randomString = JUserHelper::genRandomPassword();
if (version_compare(JVERSION, '3.2', 'ge')) {
$hash = JApplication::getHash($randomString);
} else {
$hash = JFactory::getApplication()->getHash($randomString);
}
$params['activation'] = $hash;
$user->bind($params);
$userIsSaved = $user->save();
if ($userIsSaved) {
return $user->id;
} else {
return false;
}
}
开发者ID:jonatasmm,项目名称:akeebasubs,代码行数:35,代码来源:jusers.php
示例11: onAfterInitialise
/**
* Event onAfterInitialise
*
* @access public
* @param null
* @return null
*/
public function onAfterInitialise()
{
// If this is the Administrator-application, or if debugging is set, do nothing
$application = JFactory::getApplication();
if ($application->isAdmin()) {
return;
}
// Disable browser-detection
$application->setDetectBrowser(false);
// Detect the language
$languageTag = JFactory::getLanguage()->getTag();
$languageInput = JRequest::getString('language');
// Get the bindings
$bindings = $this->getBindings();
// Check for the binding of the current language
if (!empty($languageInput)) {
if (isset($bindings[$languageTag])) {
$domain = $bindings[$languageTag];
if (stristr(JURI::current(), $domain) == false) {
// Add URL-elements to the domain
$domain = $this->getUrlFromDomain($domain);
// Replace the current domain with the new domain
$currentUrl = JURI::current();
$newUrl = str_replace(JURI::base(), $domain, $currentUrl);
// Strip out the sef-language-part
$languages = JLanguageHelper::getLanguages('sef');
foreach ($languages as $languageSef => $language) {
if ($language->lang_code == $languageTag) {
//$newUrl = str_replace('/'.$languageSef.'/', '/', $newUrl); // @todo: This d
break;
}
}
// Set the cookie
$conf = JFactory::getConfig();
$cookie_domain = $conf->get('config.cookie_domain', '');
$cookie_path = $conf->get('config.cookie_path', '/');
setcookie(JApplication::getHash('language'), $languageTag, time() + 365 * 86400, $cookie_path, $cookie_domain);
// Redirect
$application->redirect($newUrl);
$application->close();
}
}
} else {
// Check if the current default language is correct
foreach ($bindings as $languageCode => $domain) {
if (stristr(JURI::current(), $domain) == true) {
// Set the cookie
$conf = JFactory::getConfig();
$cookie_domain = $conf->get('config.cookie_domain', '');
$cookie_path = $conf->get('config.cookie_path', '/');
setcookie(JApplication::getHash('language'), $languageCode, time() + 365 * 86400, $cookie_path, $cookie_domain);
// Change the current default language
JRequest::setVar('language', $languageCode);
JFactory::getLanguage()->setDefault($languageCode);
JFactory::getLanguage()->setLanguage($languageCode);
break;
}
}
}
}
开发者ID:renekreijveld,项目名称:plg_system_languagedomains,代码行数:67,代码来源:languagedomains.php
示例12: check
function check()
{
jimport('joomla.filter.output');
$this->name = htmlspecialchars_decode($this->name, ENT_QUOTES);
if (empty($this->ordering)) {
$this->ordering = self::getNextOrder();
}
if (empty($this->alias)) {
$this->alias = $this->name;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('1', '', $this->alias)) == '') {
$this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
}
$this->alias = str_replace("-", "_", $this->alias);
if ($this->type == '0') {
return false;
}
if (is_array($_REQUEST['jform']['type_' . $this->type])) {
$_REQUEST['jform']['type_' . $this->type]['value'] = $this->remove_array_empty_values($_REQUEST['jform']['type_' . $this->type]['value']);
$_REQUEST['jform']['type_' . $this->type] = serialize($_REQUEST['jform']['type_' . $this->type]);
}
if ($this->type != 'image') {
$this->default_values = $_REQUEST['jform']['type_' . $this->type];
}
return true;
}
开发者ID:juanferden,项目名称:adoperp,代码行数:27,代码来源:userfield.php
示例13: loadMultilangData
function loadMultilangData($prepareElementCallback)
{
$languages = JLanguageHelper::getLanguages();
$app = JApplication::getInstance('site');
$menu = $app->getMenu();
$config = JFactory::getConfig();
$sef = $config->get('sef', 0);
$sefRewrite = $config->get('sef_rewrite', 0);
$defaultLangCode = JFactory::getLanguage()->getDefault();
$websites = array();
//$websites['*'] = $menu->getDefault('*'); // TODO add?
$languageFilterEnabled = JPluginHelper::isEnabled('system', 'languagefilter');
if (!$languageFilterEnabled || $sef != '1') {
// TODO check also if sef is enabled
return $websites;
}
$oldLanguageFilterValue = $app->setLanguageFilter(true);
// necessary that $menu->getDefault() works
foreach ($languages as $language) {
$langCode = $language->lang_code;
$default = $menu->getDefault($langCode);
if ($default && $default->language == $langCode) {
$websites[$langCode] = $prepareElementCallback($language, $langCode, $defaultLangCode, $sefRewrite);
}
}
$app->setLanguageFilter($oldLanguageFilterValue);
return $websites;
}
开发者ID:webguerilla,项目名称:joomla-linkchecker,代码行数:28,代码来源:shared_functions.php
示例14: getItems
/**
*
*/
public static function getItems($option = '')
{
static $items;
if (empty($option)) {
$com = DSC::getApp();
$option = 'com_' . $com->getName();
}
$app = JApplication::getInstance('site');
$menus = $app->getMenu();
if (empty($menus)) {
return array();
}
if (empty($items)) {
$items = array();
}
if (empty($items[$option])) {
$component = JComponentHelper::getComponent($option);
foreach ($menus->getItems('component', $option) as $item) {
if (!is_object($item)) {
continue;
}
if ($item->component_id == $component->id || $item->componentid == $component->id || !empty($item->query['option']) && $item->query['option'] == $option) {
$items[$option][] = $item;
}
}
}
if (empty($items[$option])) {
return array();
}
return $items[$option];
}
开发者ID:joomlacorner,项目名称:citruscart,代码行数:34,代码来源:route.php
示例15: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$basename = JRequest::getString(JApplication::getHash($this->_context . '.basename'), '__SITE__', 'cookie');
$this->setState('basename', $basename);
$compressed = JRequest::getInt(JApplication::getHash($this->_context . '.compressed'), 1, 'cookie');
$this->setState('compressed', $compressed);
}
开发者ID:joomline,项目名称:Joomla2.5.999,代码行数:14,代码来源:download.php
示例16: prepareTable
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = JFactory::getDate();
$user = JFactory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = JApplication::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = JApplication::stringURLSafe($table->title);
}
// Set the publish date to now
if ($table->published == 1 && intval($table->publish_up) == 0) {
$table->publish_up = $date->toSql();
}
/*
if (empty($table->id)) {
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$table->ordering = 0;
$db = JFactory::getDbo();
$query = 'SELECT MAX(ordering) FROM #__djmt_items';
if($table->catid) $query.= ' WHERE catid='. (int) $table->catid;
$db->setQuery($query);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}*/
}
开发者ID:chaudhary4k4,项目名称:modernstore,代码行数:33,代码来源:item.php
示例17: check
public function check()
{
if (trim($this->title) == '') {
$this->setError(JText::_('COM_JUDOWNLOAD_TITLE_MUST_NOT_BE_EMPTY'));
return false;
}
if (trim($this->alias) == '') {
$this->alias = $this->title;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '') {
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
}
if (trim(str_replace(' ', '', $this->description)) == '') {
$this->description = '';
}
if (!empty($this->metakeyword)) {
$bad_characters = array("\n", "\r", "\"", "<", ">");
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakeyword);
$keys = explode(',', $after_clean);
$clean_keys = array();
foreach ($keys as $key) {
if (trim($key)) {
$clean_keys[] = trim($key);
}
}
$this->metakeyword = implode(", ", $clean_keys);
}
return true;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:30,代码来源:license.php
示例18: check
/**
* Overloaded check function
*
* @return boolean
* @see JTable::check
* @since 1.5
*/
function check()
{
// Require helper
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'je_content.php';
jimport('joomla.filter.output');
// Set title
$this->title = htmlspecialchars_decode($this->title, ENT_QUOTES);
// Set alias
$this->alias = JE_ContentHelper::convertAlias($this->title);
$this->alias = JApplication::stringURLSafe($this->alias);
// Check the publish down date is not earlier than publish up.
if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
// Swap the dates.
$temp = $this->publish_up;
$this->publish_up = $this->publish_down;
$this->publish_down = $temp;
}
// Set ordering
if ($this->state < 0) {
// Set ordering to 0 if state is archived or trashed
$this->ordering = 0;
} else {
if (empty($this->ordering)) {
// Set ordering to last if ordering was 0
$this->ordering = self::getNextOrder('`catid`=' . $this->_db->Quote($this->catid) . ' AND state>=0');
}
}
return true;
}
开发者ID:ngxuanmui,项目名称:hanhphuc.vn,代码行数:36,代码来源:article.php
示例19: getAliasName
public static function getAliasName($alias) {
$alias = JApplication::stringURLSafe($alias);
if (trim(str_replace('-', '', $alias)) == '') {
$alias = JFactory::getDate()->format("Y-m-d-H-i-s");
}
return $alias;
}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:7,代码来源:utils.php
示例20: addMenuItems
/**
* Method to add menu's item.
*
* @return boolean true on success false on failure.
*/
function addMenuItems()
{
$db = JFactory::getDBO();
// Get new component id.
$component = JComponentHelper::getComponent('com_community');
$component_id = 0;
if (is_object($component) && isset($component->id)) {
$component_id = $component->id;
}
$column_name = JOOMLA_MENU_NAME;
$column_cid = JOOMLA_MENU_COMPONENT_ID;
// Get the default menu type
// 2 Joomla bugs occur in /Administrator mode
// Bug 1: JFactory::getApplication('site') failed. It always return id = 'administrator'.
// Bug 2: JMenu::getDefault('*') failed. JAdministrator::getLanguageFilter() doesn't exist.
// If these 2 bugs are fixed, we can call the following syntax:
// $defaultMenuType = JFactory::getApplication('sites')->getMenu()->getDefault()->menutype;
jimport('joomla.application.application');
$defaultMenuType = JApplication::getInstance('site')->getMenu()->getDefault('workaround_joomla_bug')->menutype;
$query = 'SELECT ' . $db->nameQuote('ordering') . ' ' . 'FROM ' . $db->nameQuote('#__menu') . ' ' . 'ORDER BY ' . $db->nameQuote('ordering') . ' DESC LIMIT 1';
$db->setQuery($query);
$order = $db->loadResult() + 1;
// Update the existing menu items.
$row = JTable::getInstance('menu', 'JTable');
$row->menutype = $defaultMenuType;
$row->{$column_name} = 'JomSocial';
$row->alias = 'JomSocial';
$row->link = 'index.php?option=com_community&view=frontpage';
$row->type = 'component';
$row->published = '1';
$row->{$column_cid} = $component_id;
$row->ordering = $order;
$row->id = null;
//new item
if (!JOOMLA_LEGACY_VERSION) {
$row->language = '*';
}
$row->check();
if (!$row->store()) {
// $row->getError()
return false;
}
//for version 1.6 only. The parent_id is not updated correctly via JTable
if (!JOOMLA_LEGACY_VERSION) {
$query = 'UPDATE ' . $db->nameQuote('#__menu') . ' SET `parent_id` = ' . $db->quote(1) . ', `level` = ' . $db->quote(1) . ' WHERE `id` = ' . $db->quote($row->id);
$db->setQuery($query);
$db->query();
if ($db->getErrorNum()) {
return false;
}
}
if (!addDefaultToolbarMenus()) {
return false;
}
// update memu items with component id
if (!updateMenuItems()) {
return false;
}
return true;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:65,代码来源:defaultItems.php
注:本文中的JApplication类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论