当前位置: 首页>>代码示例>>PHP>>正文


PHP JFactory::getSession方法代码示例

本文整理汇总了PHP中JFactory::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getSession方法的具体用法?PHP JFactory::getSession怎么用?PHP JFactory::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFactory的用法示例。


在下文中一共展示了JFactory::getSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getOptions

 /**
  * Get the available fields
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		protected
  * @param
  * @return 		array	an array of options
  * @since 		4.3
  */
 protected function getOptions()
 {
     // Get the template ID
     $jinput = JFactory::getApplication()->input;
     $session = JFactory::getSession();
     $sess_template_id = $session->get('com_csvi.select_template', 0);
     if ($sess_template_id !== 0) {
         $sess_template_id = unserialize($sess_template_id);
     }
     $template_id = $jinput->get('template_id', $sess_template_id, 'int');
     // Load the selected template
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/template.php';
     $template = new CsviTemplate();
     $template->load($template_id);
     // Load the available fields
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/availablefields.php';
     $availablefields_model = new CsviModelAvailablefields();
     $fields = $availablefields_model->getAvailableFields($template->get('operation', 'options'), $template->get('component', 'options'), 'array');
     if (!is_array($fields)) {
         $avfields = array();
     } else {
         $avfields = array();
         foreach ($fields as $field) {
             $avfields[$field] = $field;
         }
     }
     return array_merge(parent::getOptions(), $avfields);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:40,代码来源:csviavailablefields.php

示例2: populateState

 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return	void
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
     $this->setState('filter.access', $access);
     $authorId = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
     $this->setState('filter.author_id', $authorId);
     $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
     $this->setState('filter.published', $published);
     $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
     $this->setState('filter.category_id', $categoryId);
     $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
     $this->setState('filter.level', $level);
     $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
     $this->setState('filter.language', $language);
     // List state information.
     parent::populateState('a.title', 'asc');
 }
开发者ID:joomline,项目名称:Joomla2.5.999,代码行数:34,代码来源:articles.php

示例3: fetchMethodForm

 function fetchMethodForm($uid, $step, $update = false)
 {
     global $task;
     switch ($step) {
         case 2:
             $lists = array();
             $lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false);
             return HTML_DMUploadMethod::linkFileForm($lists);
             break;
         case 3:
             $url = stripslashes(JRequest::getString('url', 'http://'));
             $err = DMUploadMethod::linkFileProcess($uid, $step, $url);
             if ($err['_error']) {
                 _returnTo($task, $err['_errmsg'], '', array("method" => 'link', "step" => $step - 1, "localfile" => '', "url" => DOCMAN_Utils::safeEncodeURL($url)));
             }
             $uploaded = DOCMAN_Utils::safeEncodeURL(_DM_DOCUMENT_LINK . $url);
             $catid = $update ? 0 : $uid;
             $docid = $update ? $uid : 0;
             $session = JFactory::getSession();
             $session->set('docman.dmfilename', _DM_DOCUMENT_LINK);
             $session->set('docman.document_url', $url);
             return fetchEditDocumentForm($docid, $uploaded, $catid);
             break;
         default:
             break;
     }
     return true;
 }
开发者ID:janssit,项目名称:www.ondernemenddiest.be,代码行数:28,代码来源:upload.link.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: populateState

 /**
  * Method to build an SQL query to load the list data.
  *
  * @return string  An SQL query
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     $search = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
     $this->setState('filter.access', $access);
     $artist = $app->getUserStateFromRequest($this->context . '.filter.artist', 'filter_artist');
     $this->setState('filter.artist', $artist);
     $album = $app->getUserStateFromRequest($this->context . '.filter.album', 'filter_album', '');
     $this->setState('filter.album', $album);
     $categoryId = $app->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
     $this->setState('filter.category_id', $categoryId);
     $userId = $app->getUserStateFromRequest($this->context . '.filter.user_id', 'filter_user_id');
     $this->setState('filter.user_id', $userId);
     $year = $app->getUserStateFromRequest($this->context . '.filter.year', 'filter_year', '');
     $this->setState('filter.year', $year);
     // Load the parameters.
     $params = $app->getParams();
     $this->setState('params', $params);
     // process show_noauth parameter
     if (!$params->get('show_noauth', 1)) {
         $this->setState('filter.access', true);
     } else {
         $this->setState('filter.access', false);
     }
     // List state information.
     parent::populateState('a.title', 'asc');
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:40,代码来源:genre.php

示例6: send_certificate

    function send_certificate()
    {
        $app = JFactory::getApplication();
        $params = $app->getParams();
        $moodle_url = $params->get('MOODLE_URL');
        $cert_id = JRequest::getVar('cert_id');
        $simple = JRequest::getVar('simple');
        $email = JRequest::getString('mailto', '', 'post');
        $sender = JRequest::getString('sender', '', 'post');
        $from = JRequest::getString('from', '', 'post');
        $user = JFactory::getUser();
        $username = $user->username;
        $subject_default = JText::sprintf('COM_JOOMDLE_CERTIFICATE_EMAIL_SUBJECT', $user->name);
        $subject = JRequest::getString('subject', $subject_default, 'post');
        if (!$subject) {
            $subject = $subject_default;
        }
        $mailer = JFactory::getMailer();
        $config = JFactory::getConfig();
        $sender = array($config->get('mailfrom'), $config->get('fromname'));
        $mailer->setSender($sender);
        $mailer->addRecipient($email);
        $body = JText::sprintf('COM_JOOMDLE_CERTIFICATE_EMAIL_BODY', $user->name);
        $mailer->setSubject($subject);
        $mailer->setBody($body);
        $session = JFactory::getSession();
        $token = md5($session->getId());
        $pdf = file_get_contents($moodle_url . '/auth/joomdle/' . $simple . 'certificate_view.php?id=' . $cert_id . '&certificate=1&action=review&username=' . $username . '&token=' . $token);
        $tmp_path = $config->get('tmp_path');
        $filename = 'certificate-' . $cert_id . '-' . $user->name . '.pdf';
        file_put_contents($tmp_path . '/' . $filename, $pdf);
        $mailer->addAttachment($tmp_path . '/' . $filename);
        $send = $mailer->Send();
        unlink($tmp_path . '/' . $filename);
        if ($send !== true) {
            JError::raiseNotice(500, JText::_('COM_JOOMDLE_EMAIL_NOT_SENT'));
        } else {
            ?>
<div style="padding: 10px;">
    <div style="text-align:right">
        <a href="javascript: void window.close()">
            <?php 
            echo JText::_('COM_JOOMDLE_CLOSE_WINDOW');
            ?>
 <?php 
            echo JHtml::_('image', 'mailto/close-x.png', NULL, NULL, true);
            ?>
</a>
    </div>

    <h2>
        <?php 
            echo JText::_('COM_JOOMDLE_EMAIL_SENT');
            ?>
    </h2>
</div>

<?php 
        }
    }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:60,代码来源:certificate.php

示例7: getRows

 function getRows(&$params, $start = 0, $limit, $detail_filter)
 {
     $db = JFactory::getDBO();
     $session =& JFactory::getSession();
     if (!isset($limit)) {
         $limit = intval($params->get('limit', 5));
     }
     if (!isset($detail_filter)) {
         $detail_filter = $params->get('detail_filter', 'low');
     }
     $where = '';
     if ($detail_filter == 'low') {
         $where = 'and (r.task = "apply" or r.task = "save")';
     } elseif ($detail_filter == 'medium') {
         $where = 'and (r.task != "cancel" and r.task != "preview" and r.option != "com_cpanel")';
     }
     // get admin activity
     $query = 'select r.*, u.name, u.username, u.email,e.name as extension from #__rokadminaudit as r, #__users as u, #__extensions as e where r.user_id = u.id and e.element = r.option ' . $where . ' order by id desc limit ' . intval($limit);
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     // rows count
     $query = 'select count(*), r.*, u.name, u.username, u.email,e.name as extension from #__rokadminaudit as r, #__users as u, #__extensions as e where r.user_id = u.id and e.element = r.option ' . $where . ' order by id desc';
     $db->setQuery($query);
     $count = $db->loadResult();
     return array('rows' => $rows, 'count' => $count);
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:26,代码来源:helper.php

示例8: export

 function export()
 {
     $selectedMail = JRequest::getInt('filter_mail', 0);
     $selectedStatus = JRequest::getString('filter_status', '');
     $filters = array();
     if (!empty($selectedMail)) {
         $filters[] = 'a.mailid = ' . $selectedMail;
     }
     if (!empty($selectedStatus)) {
         if ($selectedStatus == 'bounce') {
             $filters[] = 'a.bounce > 0';
         } elseif ($selectedStatus == 'open') {
             $filters[] = 'a.open > 0';
         } elseif ($selectedStatus == 'notopen') {
             $filters[] = 'a.open < 1';
         } elseif ($selectedStatus == 'failed') {
             $filters[] = 'a.fail > 0';
         }
     }
     $query = 'SELECT `subid` FROM `#__acymailing_userstats` as a ';
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     $currentSession =& JFactory::getSession();
     $currentSession->set('acyexportquery', $query);
     $this->setRedirect(acymailing_completeLink('data&task=export&sessionquery=1', false, true));
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:27,代码来源:stats.php

示例9: saveRemark

 function saveRemark()
 {
     $db = JFactory::getDBO();
     $post = JRequest::get('post');
     ## Getting the global DB session
     $session = JFactory::getSession();
     ## Gettig the orderid if there is one.
     $ordercode = $session->get('ordercode');
     if ($ordercode != $this->ordercode) {
         $msg = '<font color="#FF0000">' . JText::_('COM_TICKETMASTER_SAVING_CONTENT_FAILED') . '</font>';
         ### Odercodes are not the same
         $arr = array('status' => '666', 'msg' => $msg);
         echo json_encode($arr);
     } else {
         $model = $this->getModel('cart');
         ## Making the query for showing all the cars in list function
         $sql = 'SELECT id FROM #__ticketmaster_remarks WHERE ordercode = "' . $ordercode . '"';
         $db->setQuery($sql);
         $remarks = $db->loadObject();
         if ($remarks->id != 0) {
             $post['id'] = $remarks->id;
         }
         $post['remarks'] = $new_string = filter_var($this->remark, FILTER_SANITIZE_STRING);
         $post['ordercode'] = $ordercode;
         if (!$model->storeRemark($post)) {
             $msg = '<font color="#FF0000">' . JText::_('COM_TICKETMASTER_SAVING_CONTENT_FAILED') . '</font>';
             ### Odercodes are not the same
             $arr = array('status' => '666', 'msg' => $msg);
             echo json_encode($arr);
         } else {
             $arr = array('status' => '200', 'msg' => JText::_('COM_TICKETMASTER_CONTENT_SAVED'));
             echo json_encode($arr);
         }
     }
 }
开发者ID:novalnetuser,项目名称:Jeremiah-s-Ranch,代码行数:35,代码来源:cart.php

示例10: onUserAfterSave

 public function onUserAfterSave($user, $isnew, $success, $msg)
 {
     $guruses = JFactory::getSession();
     $guru_data = $guruses->get("guru_data", "");
     $guru_action = $guruses->get("guru_action", "0");
     $option = JRequest::getVar("option", "");
     $view = JRequest::getVar("view", "");
     $task = JRequest::getVar("task", "");
     if ($guru_action == "1" && $option == "com_community" && $view == "register" && $task == "registerUpdateProfile") {
         $db = JFactory::getDbo();
         $data = json_decode($guru_data, true);
         $userpassword = $this->encriptPassword($data['password']);
         if ($data["guru_teacher"] == 1) {
             $sql = "insert into #__guru_customer(`id`, `company`, `firstname`, `lastname`) values (" . intval($user['id']) . ", '" . addslashes(trim($data['company'])) . "', '" . addslashes(trim($data['firstname'])) . "', '" . addslashes(trim($data['lastname'])) . "')";
         } elseif ($data["guru_teacher"] == 2) {
             $data["full_bio"] = JRequest::getVar("full_bio", "", "post", "string", JREQUEST_ALLOWRAW);
             $sql = "INSERT INTO `#__guru_authors` (`userid`, `gid`, `full_bio`, `images`, `emaillink`, `website`, `blog`, `facebook`, `twitter`, `show_email`, `show_website`, `show_blog`, `show_facebook`, `show_twitter`, `author_title`, `ordering`, `forum_kunena_generated`) VALUES('" . intval($user['id']) . "', 2, '" . $data["full_bio"] . "', '" . $data["images"] . "', '" . $data["emaillink"] . "', '" . $data["website"] . "', '" . $data["blog"] . "', '" . $data["facebook"] . "','" . $data["twitter"] . "', '" . $data["show_email"] . "', '" . $data["show_website"] . "', '" . $data["show_blog"] . "', '" . $data["show_facebook"] . "', '" . $data["show_twitter"] . "',  '" . $data["author_title"] . "', '" . $data["ordering"] . "', '')";
         }
         $db->setQuery($sql);
         $db->query();
         $sql = "delete from  #__community_users where userid = 0";
         $db->setQuery($sql);
         $db->query();
         $sql = "update #__users set password ='" . $userpassword . "' where id =" . intval($user['id']);
         $db->setQuery($sql);
         $db->query();
         $guruses->set("guru_data", "");
         $guruses->set("guru_action", "0");
     }
 }
开发者ID:JozefAB,项目名称:neoacu,代码行数:30,代码来源:guru_user_update.php

示例11: CaptchaSecurityImages

 function CaptchaSecurityImages($width = '120', $height = '40', $characters = '6')
 {
     $code = $this->generateCode($characters);
     /* font size will be 75% of the image height */
     $font_size = $height * 0.75;
     $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
     /* set the colours */
     $background_color = imagecolorallocate($image, 255, 255, 255);
     $text_color = imagecolorallocate($image, 20, 40, 100);
     $noise_color = imagecolorallocate($image, 100, 120, 180);
     /* generate random dots in background */
     for ($i = 0; $i < $width * $height / 3; $i++) {
         imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color);
     }
     /* generate random lines in background */
     for ($i = 0; $i < $width * $height / 150; $i++) {
         imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color);
     }
     /* create textbox and add text */
     $thispath = dirname(__FILE__) . '/';
     $textbox = imagettfbbox($font_size, 0, $thispath . $this->font, $code) or die('Error in imagettfbbox function');
     $x = ($width - $textbox[4]) / 2;
     $y = ($height - $textbox[5]) / 2;
     imagettftext($image, $font_size, 0, $x, $y, $text_color, $thispath . $this->font, $code) or die('Error in imagettftext function');
     /* output captcha image to browser */
     header('Content-Type: image/jpeg');
     imagejpeg($image);
     imagedestroy($image);
     $session = JFactory::getSession();
     $session->set('security_code', $code);
 }
开发者ID:C-Lodder,项目名称:Uddeim,代码行数:31,代码来源:captcha15.php

示例12: getOptions

 protected function getOptions()
 {
     $session = JFactory::getSession();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     // To avoid user's confusion, readonly="true" should imply disabled="true".
     if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
         $attr .= ' disabled="disabled"';
     }
     //
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     $db = JFactory::getDBO();
     $db->setQuery("SELECT t.name AS name, t.id AS id FROM #__k2_tags AS t WHERE published = 1 ORDER BY t.name ASC");
     $results = $db->loadObjectList();
     $tags = array();
     if (count($results)) {
         foreach ($results as $tag) {
             $tags[] = JHtml::_('select.option', $tag->id, $tag->name);
         }
         $tags = array_merge(parent::getOptions(), $tags);
         return $tags;
     } else {
         $tags = array();
         return $tags;
     }
 }
开发者ID:grchis,项目名称:Site-Auto,代码行数:30,代码来源:k2tags.php

示例13: getConnection

 /**
  * Return memcached connection object
  *
  * @return  object   memcached connection object
  *
  * @since   12.1
  */
 protected function getConnection()
 {
     if ((extension_loaded('memcached') && class_exists('Memcached')) != true) {
         return false;
     }
     $config = JFactory::getConfig();
     $this->_persistent = $config->get('memcache_persist', true);
     $this->_compress = $config->get('memcache_compress', false) == false ? 0 : Memcached::OPT_COMPRESSION;
     /*
      * This will be an array of loveliness
      * @todo: multiple servers
      * $servers	= (isset($params['servers'])) ? $params['servers'] : array();
      */
     $server = array();
     $server['host'] = $config->get('memcache_server_host', 'localhost');
     $server['port'] = $config->get('memcache_server_port', 11211);
     // Create the memcache connection
     if ($this->_persistent) {
         $session = JFactory::getSession();
         self::$_db = new Memcached($session->getId());
     } else {
         self::$_db = new Memcached();
     }
     $memcachedtest = self::$_db->addServer($server['host'], $server['port']);
     if ($memcachedtest == false) {
         return JError::raiseError(404, "Could not connect to memcached server");
     }
     self::$_db->setOption(Memcached::OPT_COMPRESSION, $this->_compress);
     // Memcached has no list keys, we do our own accounting, initialise key index
     if (self::$_db->get($this->_hash . '-index') === false) {
         $empty = array();
         self::$_db->set($this->_hash . '-index', $empty, 0);
     }
     return;
 }
开发者ID:jimyb3,项目名称:mathematicalteachingsite,代码行数:42,代码来源:memcached.php

示例14: display

 function display($tpl = null)
 {
     global $mainframe;
     $style = $mainframe->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
     $listStyle = "\n\t\t\t<ul id=\"submenu\">\n\t\t\t\t<li><a id=\"thumbs\" onclick=\"MediaManager.setViewType('thumbs')\">" . JText::_('Thumbnail View') . "</a></li>\n\t\t\t\t<li><a id=\"details\" onclick=\"MediaManager.setViewType('details')\">" . JText::_('Detail View') . "</a></li>\n\t\t\t</ul>\n\t\t";
     $document =& JFactory::getDocument();
     $document->setBuffer($listStyle, 'module', 'submenu');
     JHTML::_('behavior.mootools');
     $document->addScript('components/com_media/assets/mediamanager.js');
     $document->addStyleSheet('components/com_media/assets/mediamanager.css');
     JHTML::_('behavior.modal');
     $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});");
     JHTML::script('mootree.js');
     JHTML::stylesheet('mootree.css');
     JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ MediaManager.refreshFrame(); }'));
     $base = str_replace("\\", "/", JPATH_ROOT);
     $js = "\n\t\t\tvar basepath = '" . $base . '/images' . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t";
     $document->addScriptDeclaration($js);
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     jimport('joomla.client.helper');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('config', JComponentHelper::getParams('com_media'));
     $this->assignRef('state', $this->get('state'));
     $this->assign('require_ftp', $ftp);
     $this->assign('folders_id', ' id="media-tree"');
     $this->assign('folders', $this->get('folderTree'));
     // Set the toolbar
     $this->_setToolBar();
     parent::display($tpl);
     echo JHTML::_('behavior.keepalive');
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:35,代码来源:view.html.php

示例15: getOptions

 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Detect the native language.
     $native = JLanguageHelper::detectLanguage();
     if (empty($native)) {
         $native = 'en-GB';
     }
     // Get a forced language if it exists.
     $forced = $app->getLocalise();
     if (!empty($forced['language'])) {
         $native = $forced['language'];
     }
     // If a language is already set in the session, use this instead
     $session = JFactory::getSession()->get('setup.options', array());
     if (!empty($session['language'])) {
         $native = $session['language'];
     }
     // Get the list of available languages.
     $options = JLanguageHelper::createLanguageList($native);
     if (!$options || $options instanceof Exception) {
         $options = array();
     } else {
         usort($options, array($this, '_sortLanguages'));
     }
     // Set the default value from the native language.
     $this->value = $native;
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:joomline,项目名称:Joomla2.5.999,代码行数:38,代码来源:language.php


注:本文中的JFactory::getSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。