PageRenderTime 36ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/system/jsntplframework/libraries/joomlashine/utils.php

https://bitbucket.org/pastor399/newcastleunifc
PHP | 787 lines | 588 code | 70 blank | 129 comment | 108 complexity | 015657dfca42e5590e856dc6c58b474a MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @package JSNExtension
  5. * @subpackage JSNTPLFramework
  6. * @author JoomlaShine Team <support@joomlashine.com>
  7. * @copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
  8. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
  9. *
  10. * Websites: http://www.joomlashine.com
  11. * Technical Support: Feedback - http://www.joomlashine.com/contact-us/get-support.html
  12. */
  13. // No direct access to this file
  14. defined('_JEXEC') or die('Restricted access');
  15. /**
  16. * Utilities class
  17. *
  18. * @package JSNTPLFramework
  19. * @subpackage Template
  20. * @since 1.0.0
  21. */
  22. class JSNTplUtils
  23. {
  24. /**
  25. * Return class instance
  26. *
  27. */
  28. public static function getInstance() {
  29. static $instance;
  30. if ($instance == null) {
  31. $instance = new JSNTplUtils();
  32. }
  33. return $instance;
  34. }
  35. /**
  36. * Get and store template attributes
  37. *
  38. */
  39. public function getTemplateAttributes($attrs_array, $template_prefix, $pageclass) {
  40. $template_attrs = null;
  41. if(count($attrs_array)) {
  42. foreach ($attrs_array as $attr_name => $attr_values) {
  43. $t_attr = null;
  44. // Get template settings from page class suffix
  45. if(!empty($pageclass)){
  46. $pc = 'custom-'.$attr_name.'-';
  47. $pc_len = strlen($pc);
  48. $pclasses = explode(" ", $pageclass);
  49. foreach($pclasses as $pclass){
  50. if(substr($pclass, 0, $pc_len) == $pc) {
  51. $t_attr = substr($pclass, $pc_len, strlen($pclass)-$pc_len);
  52. }
  53. }
  54. }
  55. if( isset( $_GET['jsn_setpreset'] ) && $_GET['jsn_setpreset'] == 'default' ) {
  56. setcookie($template_prefix.$attr_name, '', time() - 3600, '/');
  57. } else {
  58. // Apply template settings from cookies
  59. if (isset($_COOKIE[$template_prefix.$attr_name])) {
  60. $t_attr = $_COOKIE[$template_prefix.$attr_name];
  61. }
  62. // Apply template settings from permanent request parameters
  63. if (isset($_GET['jsn_set'.$attr_name])) {
  64. setcookie($template_prefix.$attr_name, trim($_GET['jsn_set'.$attr_name]), time() + 3600, '/');
  65. $t_attr = trim($_GET['jsn_set'.$attr_name]);
  66. }
  67. }
  68. // Store template settings
  69. $template_attrs[$attr_name] = null;
  70. if(is_array($attr_values)){
  71. if (in_array($t_attr, $attr_values)) {
  72. $template_attrs[$attr_name] = $t_attr;
  73. }
  74. } else if($attr_values == 'integer'){
  75. $template_attrs[$attr_name] = intval($t_attr);
  76. }
  77. }
  78. }
  79. return $template_attrs;
  80. }
  81. public function getTemplateDetails()
  82. {
  83. require_once 'jsn_readxmlfile.php';
  84. $jsn_readxml = new JSNReadXMLFile();
  85. return $jsn_readxml->getTemplateInfo();
  86. }
  87. private $_isJoomla3 = null;
  88. public function isJoomla3 () {
  89. if ($this->_isJoomla3 == null) {
  90. $version = new JVersion();
  91. $this->_isJoomla3 = version_compare($version->getShortVersion(), '3.0', '>=');
  92. }
  93. return $this->_isJoomla3;
  94. }
  95. /**
  96. * Get template parameters
  97. *
  98. */
  99. function getTemplateParameters()
  100. {
  101. return JFactory::getApplication()->getTemplate(true)->params;
  102. }
  103. /**
  104. * Get the front-end template name
  105. *
  106. */
  107. public function getTemplateName()
  108. {
  109. $document = JFactory::getDocument();
  110. return $document->template;
  111. }
  112. /**
  113. * Add template attribute to URL, used by Site Tools
  114. *
  115. */
  116. public function addAttributeToURL($key, $value) {
  117. $url = $_SERVER['REQUEST_URI'];
  118. $url = JFilterOutput::ampReplace($url);
  119. for($i = 0, $count_key = substr_count($url, 'jsn_set'); $i < $count_key; $i ++) {
  120. $url = preg_replace('/(.*)(\?|&)jsn_set[a-z]{0,30}=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
  121. $url = substr($url, 0, -1);
  122. }
  123. if (strpos($url, '?') === false) {
  124. return ($url . '?' . $key . '=' . $value);
  125. } else {
  126. return ($url . '&amp;' . $key . '=' . $value);
  127. }
  128. }
  129. /**
  130. * Return the number of module positions count
  131. *
  132. */
  133. public function countPositions($t, $positions) {
  134. $positionCount = 0;
  135. for($i=0;$i < count($positions); $i++){
  136. if ($t->countModules($positions[$i])) $positionCount++;
  137. }
  138. return $positionCount;
  139. }
  140. /**
  141. * Get template positions
  142. *
  143. */
  144. public function getPositions($template)
  145. {
  146. jimport('joomla.filesystem.folder');
  147. $result = array();
  148. $client = JApplicationHelper::getClientInfo(0);
  149. if ($client === false)
  150. {
  151. return false;
  152. }
  153. require_once 'jsn_readxmlfile.php';
  154. $jsn_readxml = new JSNReadXMLFile();
  155. $positions = $jsn_readxml->getTemplatePositions();
  156. $positions = array_unique($positions);
  157. if(count($positions))
  158. {
  159. foreach ($positions as $value)
  160. {
  161. $classModule = new stdClass();
  162. $classModule->value = $value;
  163. $classModule->text = $value;
  164. if(preg_match("/-m+$/", $value))
  165. {
  166. $result['mobile'] [] = $classModule;
  167. }
  168. else
  169. {
  170. $result['desktop'] [] = $classModule;
  171. }
  172. }
  173. }
  174. return $result;
  175. }
  176. /**
  177. * render positions ComboBox
  178. *
  179. */
  180. public function renderPositionComboBox($ID, $data, $elementText, $elementName, $parameters = '')
  181. {
  182. array_unshift($data, JHTML::_('select.option', 'none', JText::_('NO_MAPPING'), 'value', 'text'));
  183. return JHTML::_('select.genericlist', $data, $elementName, $parameters, 'value', 'text', $ID);
  184. }
  185. /**
  186. * Wrap first word inside a <span>
  187. *
  188. */
  189. public function wrapFirstWord( $value )
  190. {
  191. $processed_string = null;
  192. $explode_string = explode(' ', trim( $value ) );
  193. for ( $i=0; $i < count( $explode_string ); $i++ )
  194. {
  195. if( $i == 0 )
  196. {
  197. $processed_string .= '<span>'.$explode_string[$i].'</span>';
  198. }
  199. else
  200. {
  201. $processed_string .= ' '.$explode_string[$i];
  202. }
  203. }
  204. return $processed_string;
  205. }
  206. /**
  207. * Trim precedding slash
  208. *
  209. */
  210. public function trimPreceddingSlash($string)
  211. {
  212. $string = trim($string);
  213. if (substr($string, 0, 1) == '\\' || substr($string, 0, 1) == '/') {
  214. $string = substr($string, 1);
  215. }
  216. return $string;
  217. }
  218. /**
  219. * Trim ending slash
  220. *
  221. */
  222. public function trimEndingSlash($string)
  223. {
  224. $string = trim($string);
  225. if (substr($string, -1) == '\\' || substr($string, -1) == '/') {
  226. $string = substr($string, 0, -1);
  227. }
  228. return $string;
  229. }
  230. /**
  231. * Trim both ending slash
  232. *
  233. */
  234. public function trimSlash($string)
  235. {
  236. $string = trim($string);
  237. $string = $this->trimPreceddingSlash($string);
  238. $string = $this->trimEndingSlash($string);
  239. return $string;
  240. }
  241. /**
  242. * Strip extra space
  243. *
  244. */
  245. public function StripExtraSpace($s)
  246. {
  247. $newstr = "";
  248. for($i = 0; $i < strlen($s); $i++)
  249. {
  250. $newstr = $newstr.substr($s, $i, 1);
  251. if(substr($s, $i, 1) == ' ')
  252. while(substr($s, $i + 1, 1) == ' ')
  253. $i++;
  254. }
  255. return $newstr;
  256. }
  257. /**
  258. * Get mobile device
  259. *
  260. */
  261. public function getMobileDevice()
  262. {
  263. $user_agent = $_SERVER['HTTP_USER_AGENT'];
  264. $mobileDeviceName = null;
  265. switch( true )
  266. {
  267. case ( preg_match( '/ipod/i', $user_agent ) || preg_match( '/iphone/i', $user_agent ) ):
  268. $mobileDeviceName = 'iphone';
  269. break;
  270. case ( preg_match( '/ipad/i', $user_agent ) ):
  271. $mobileDeviceName = 'ipad';
  272. break;
  273. case ( preg_match( '/android/i', $user_agent ) ):
  274. $mobileDeviceName = 'android';
  275. break;
  276. case ( preg_match( '/opera mini/i', $user_agent ) ):
  277. $mobileDeviceName = 'opera';
  278. break;
  279. case ( preg_match( '/blackberry/i', $user_agent ) ):
  280. $mobileDeviceName = 'blackberry';
  281. break;
  282. case ( preg_match( '/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i', $user_agent ) ):
  283. $mobileDeviceName = 'palm';
  284. break;
  285. case ( preg_match( '/(windows ce; ppc;|windows mobile;|windows ce; smartphone;|windows ce; iemobile|windows phone)/i', $user_agent ) ):
  286. $mobileDeviceName = 'windows';
  287. break;
  288. }
  289. return $mobileDeviceName;
  290. }
  291. /**
  292. * Check folder is writable or not.
  293. *
  294. */
  295. public function checkFolderWritable($path)
  296. {
  297. if (!is_writable($path)) {
  298. return false;
  299. }
  300. return true;
  301. }
  302. /**
  303. * Clean up cache folder.
  304. *
  305. */
  306. public function cleanupCacheFolder($template_name = '', $css_js_compression = 0, $cache_folder_path)
  307. {
  308. $cache_folder_path = str_replace('/', DIRECTORY_SEPARATOR, $cache_folder_path);
  309. if( $css_js_compression != 1 && $css_js_compression != 2 ) {
  310. if( $handle = opendir($cache_folder_path) ) {
  311. while (false !== ($file = readdir($handle))) {
  312. $pattern = '/^'.$template_name.'_css/';
  313. if( preg_match($pattern, $file) > 0 ) {
  314. @unlink($cache_folder_path.'/'.$file);
  315. }
  316. }
  317. }
  318. }
  319. if( $css_js_compression != 1 && $css_js_compression != 3 ) {
  320. if( $handle = opendir($cache_folder_path) ) {
  321. while (false !== ($file = readdir($handle))) {
  322. $pattern = '/^'.$template_name.'_js/';
  323. if (preg_match($pattern, $file) > 0) {
  324. @unlink($cache_folder_path.'/'.$file);
  325. }
  326. }
  327. }
  328. }
  329. }
  330. public function getAllFileInHeadSection(&$header_stuff, $type, &$ref_data)
  331. {
  332. $uri = JURI::base(true);
  333. if ($type == 'css')
  334. {
  335. $datas =& $header_stuff['styleSheets'];
  336. $file_extensions = '.css';
  337. }
  338. if ($type == 'js')
  339. {
  340. $datas =& $header_stuff['scripts'];
  341. $file_extensions = '.js';
  342. }
  343. foreach ($datas as $key => $script)
  344. {
  345. $cleaned_url = $this->clarifyUrl($key);
  346. if ($cleaned_url)
  347. {
  348. if (preg_match('#\.'.$type.'$#', $cleaned_url))
  349. {
  350. $file_name = basename($cleaned_url);
  351. $file_rel_path = dirname($cleaned_url);
  352. $file_abs_path = JPATH_ROOT. DIRECTORY_SEPARATOR .str_replace("/", DIRECTORY_SEPARATOR, $file_rel_path);
  353. $ref_data[$uri.'/'.$file_rel_path.'/'.$file_name]['file_abs_path'] = $file_abs_path;
  354. $ref_data[$uri.'/'.$file_rel_path.'/'.$file_name]['file_name'] = $file_name;
  355. // Remove them from HEAD
  356. unset($datas[$key]);
  357. }
  358. }
  359. }
  360. }
  361. function arrangeFileInHeadSection(&$header_stuff, $topScripts, $compressedFiles = array())
  362. {
  363. $data =& $header_stuff['scripts'];
  364. if (count($data))
  365. {
  366. /**
  367. * Remove compressed scripts in Header Data if they are still available (inserted by others)
  368. * However, exclude "jsn_noconflict.js" file as it might needed for external jQuery lib (Google API)
  369. */
  370. foreach ($compressedFiles as $file => $fileDetails)
  371. {
  372. if (array_key_exists($file, $data) && strpos($file, 'jsn_noconflict.js') === false)
  373. {
  374. unset($data[$file]);
  375. }
  376. }
  377. /* re-arrange file to ensure most "important" scripts are loaded first */
  378. $loadFirst = array();
  379. foreach ($topScripts as $script)
  380. {
  381. if (array_key_exists($script, $data))
  382. {
  383. $loadFirst[$script] = $data[$script];
  384. unset($data[$script]);
  385. }
  386. }
  387. $data = $loadFirst + $data;
  388. }
  389. }
  390. /**
  391. * Check item menu is the last menu
  392. *
  393. */
  394. public function isLastMenu($item)
  395. {
  396. $dbo = JFactory::getDbo();
  397. if(isset($item->tree[0]) && isset($item->tree[1])) {
  398. $query = 'SELECT lft, rgt FROM #__menu'
  399. .' WHERE id = '.$item->tree[0]
  400. .' OR id = '.$item->tree[1];
  401. $dbo->setQuery($query);
  402. $results = $dbo->loadObjectList();
  403. if($results[1]->rgt == ( (int) $results[0]->rgt - 1) && $item->deeper) {
  404. return true;
  405. } else {
  406. return false;
  407. }
  408. } else {
  409. return false;
  410. }
  411. }
  412. /**
  413. * Get browser specific information
  414. *
  415. */
  416. public function getBrowserInfo($agent = null)
  417. {
  418. $browser = array("browser"=>'', "version"=>'');
  419. $known = array("firefox", "msie", "opera", "chrome", "safari",
  420. "mozilla", "seamonkey", "konqueror", "netscape",
  421. "gecko", "navigator", "mosaic", "lynx", "amaya",
  422. "omniweb", "avant", "camino", "flock", "aol");
  423. $agent = strtolower($agent ? $agent : $_SERVER['HTTP_USER_AGENT']);
  424. foreach($known as $value)
  425. {
  426. if (preg_match("#($value)[/ ]?([0-9.]*)#", $agent, $matches))
  427. {
  428. $browser['browser'] = $matches[1];
  429. $browser['version'] = $matches[2];
  430. break;
  431. }
  432. }
  433. return $browser;
  434. }
  435. /**
  436. * Get current URL
  437. *
  438. */
  439. public function getCurrentUrl() {
  440. return JURI::getInstance()->toString();
  441. }
  442. /**
  443. * check System Cache - Plugin
  444. *
  445. */
  446. public function checkSystemCache() {
  447. $db = JFactory::getDbo();
  448. $query = "SELECT enabled " .
  449. " FROM #__extensions" .
  450. " WHERE name='plg_system_cache'"
  451. ;
  452. $db->setQuery($query);
  453. return (bool) $db->loadResult();
  454. }
  455. /**
  456. * check K2 installed or not
  457. *
  458. */
  459. public function checkK2()
  460. {
  461. $db = JFactory::getDbo();
  462. if ($this->getJoomlaVersion() == '15') {
  463. $query = "SELECT id " .
  464. " FROM #__components" .
  465. " WHERE `option` = 'com_k2'" .
  466. " AND admin_menu_alt = 'COM_K2'" .
  467. " AND enabled = 1"
  468. ;
  469. } else {
  470. $query = $db->getQuery(true);
  471. $query->select('extension_id');
  472. $query->from('`#__extensions`');
  473. $query->where("enabled = 1");
  474. $query->where("type = 'component'");
  475. $query->where("element = 'com_k2'");
  476. }
  477. $db->setQuery($query);
  478. return (bool) $db->loadResult();
  479. }
  480. /**
  481. * check VM installed or not
  482. *
  483. */
  484. public function checkVM()
  485. {
  486. $db = JFactory::getDbo();
  487. if ($this->getJoomlaVersion() == '15') {
  488. $query = "SELECT id " .
  489. " FROM #__components" .
  490. " WHERE `option` = 'com_virtuemart'" .
  491. " AND admin_menu_alt = 'com_virtuemart'" .
  492. " AND enabled = 1"
  493. ;
  494. } else {
  495. $query = $db->getQuery(true);
  496. $query->select('extension_id');
  497. $query->from('`#__extensions`');
  498. $query->where("enabled = 1");
  499. $query->where("type = 'component'");
  500. $query->where("element = 'com_virtuemart'");
  501. }
  502. $db->setQuery($query);
  503. return (bool) $db->loadResult();
  504. }
  505. public function getJoomlaVersion($glue = false)
  506. {
  507. $objVersion = new JVersion();
  508. $version = (float) $objVersion->RELEASE;
  509. if ($version <= 1.5)
  510. {
  511. return ($glue)?'1.5':'15';
  512. }
  513. elseif ($version >= 1.6 && $version <= 1.7)
  514. {
  515. return ($glue)?'2.5':'25';
  516. }
  517. else
  518. {
  519. return ($glue)?$objVersion->RELEASE:str_replace('.', '', $objVersion->RELEASE);
  520. }
  521. }
  522. public function cURLCheckFunctions()
  523. {
  524. if(!function_exists("curl_init") && !function_exists("curl_setopt") && !function_exists("curl_exec") && !function_exists("curl_close")) return false;
  525. return true;
  526. }
  527. public function fOPENCheck()
  528. {
  529. return (boolean) ini_get('allow_url_fopen');
  530. }
  531. public function fsocketopenCheck()
  532. {
  533. if (!function_exists('fsockopen')) return false;
  534. return true;
  535. }
  536. public function compareVersion($version1 , $version2)
  537. {
  538. //-1: if the first version < the second
  539. //0: if they are equal
  540. //1: if the first version > the second
  541. return version_compare($version1, $version2);
  542. }
  543. public function getTemplateManifestCache()
  544. {
  545. $template_defacto_name = $this->getTemplateName();
  546. $db = JFactory::getDbo();
  547. $query = 'SELECT manifest_cache FROM #__extensions'
  548. . ' WHERE type ="template"'
  549. . ' AND element = "' . $template_defacto_name . '"';
  550. $db->setQuery($query);
  551. return $db->loadResult();
  552. }
  553. function clarifyUrl($url)
  554. {
  555. $url = preg_replace('/[?\#]+.*$/', '', $url);
  556. if (preg_match('/^https?\:/', $url))
  557. {
  558. if (!preg_match('#^'.preg_quote(JURI::root()).'#', $url))
  559. {
  560. return false;
  561. }
  562. $url = str_replace(JURI::root(), '', $url);
  563. }
  564. if (preg_match('/^\/\//', $url))
  565. {
  566. $JUriInstance = JURI::getInstance();
  567. if (!strstr($url, $JUriInstance->getHost()))
  568. {
  569. return false;
  570. }
  571. }
  572. if (preg_match('/^\//', $url) && JURI::root(true))
  573. {
  574. if (!preg_match('#^'.preg_quote(JURI::root(true)).'#', $url))
  575. {
  576. return false;
  577. }
  578. $url = preg_replace('#^'.preg_quote(JURI::root(true)).'#', '', $url);
  579. }
  580. $url = preg_replace('/^\//', '', preg_replace('#[/\\\\]+#', '/', $url));
  581. return $url;
  582. }
  583. public function checkProEditionExist($templateName, $pro = false)
  584. {
  585. if ($pro === true)
  586. {
  587. $templateName = str_replace('free', 'pro', $templateName);
  588. }
  589. /* First, check the database */
  590. $db = JFactory::getDbo();
  591. $query = 'SELECT COUNT(*) FROM #__extensions'
  592. . ' WHERE type = "template"'
  593. . ' AND client_id = 0'
  594. . ' AND element = ' . $db->quote($templateName);
  595. $db->setQuery($query);
  596. $proRecord = $db->loadResult();
  597. if ($proRecord >= 1)
  598. {
  599. return true;
  600. }
  601. else
  602. {
  603. /* Check whether the template folder exists */
  604. $templateFolderPath = JPATH_ROOT. DIRECTORY_SEPARATOR .'templates'. DIRECTORY_SEPARATOR .$templateName;
  605. jimport('joomla.filesystem.folder');
  606. if (JFolder::exists($templateFolderPath))
  607. {
  608. return true;
  609. }
  610. }
  611. return false;
  612. }
  613. public function getLatestProductVersion($productIdName, $catName = 'template')
  614. {
  615. $codeName = 'cat_' . $catName;
  616. $latestInfo = $this->parseJsonServerInfo($codeName);
  617. if (count($latestInfo) === 0)
  618. {
  619. return false;
  620. }
  621. else
  622. {
  623. $catTemplateInfo = $latestInfo[$codeName];
  624. return $catTemplateInfo[$productIdName]->version;
  625. }
  626. }
  627. private function getLatestProductCatInfo($categoryName)
  628. {
  629. $httpRequestInstance = new JSNHTTPSocket(
  630. JSN_CAT_INFO_URL.$categoryName,
  631. null, null, 'get');
  632. return $httpRequestInstance->socketDownload();
  633. }
  634. /**
  635. * This function parses product information returned by JSN server
  636. * @param string $catName JSON-encoded string represents product info.
  637. * @return array array of product information
  638. */
  639. private function parseJsonServerInfo($categoryName)
  640. {
  641. $result = array();
  642. $catInfo = $this->getLatestProductCatInfo($categoryName);
  643. if ($catInfo !== false && $catInfo !== '')
  644. {
  645. $data = json_decode($catInfo);
  646. if (!is_null($data))
  647. {
  648. if (isset($data->items))
  649. {
  650. $category_codename = trim($data->category_codename);
  651. foreach ($data->items as $item)
  652. {
  653. if (!isset($item->category_codename) || $item->category_codename == '')
  654. {
  655. $result[$category_codename][trim($item->identified_name)] = $item;
  656. }
  657. else
  658. {
  659. $result[$category_codename][trim($item->category_codename)] = $item;
  660. }
  661. }
  662. }
  663. }
  664. }
  665. return $result;
  666. }
  667. /**
  668. * Detect site with multilang setup to correctly determine the path to front-end
  669. * index so there will be no redirection because of not having lang sef in URLs.
  670. */
  671. public function determineFrontendIndex()
  672. {
  673. /* Get JSite object for further actions */
  674. $app = JFactory::getApplication();
  675. $frontIndexPath = 'index.php';
  676. if ($app->isSite())
  677. {
  678. $languageFilter = $app->getLanguageFilter();
  679. $router = $app->getRouter();
  680. $sefMode = ($router->getMode() == JROUTER_MODE_SEF) ? '1' : '0';
  681. }
  682. else
  683. {
  684. /* Determine multilang site and add appropriate lang sef to path */
  685. $db = JFactory::getDBO();
  686. $query = $db->getQuery(true);
  687. $query->select('enabled')
  688. ->from($db->quoteName('#__extensions'))
  689. ->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
  690. ->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
  691. ->where($db->quoteName('element') . ' = ' . $db->quote('languagefilter'));
  692. $db->setQuery($query);
  693. $languageFilter = $db->loadResult();
  694. $sefMode = JFactory::getConfig()->get('sef', '0');
  695. }
  696. if ($languageFilter)
  697. {
  698. $langCode = JLanguageHelper::getLanguages('lang_code');
  699. $langDefault = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
  700. if (isset($langCode[$langDefault]))
  701. {
  702. if ($sefMode === '1')
  703. {
  704. $frontIndexPath = JFactory::getConfig()->get('sef_rewrite') ? '' : 'index.php/';
  705. $frontIndexPath .= $langCode[$langDefault]->sef.'/';
  706. }
  707. else
  708. {
  709. $frontIndexPath = 'index.php?lang='.$langCode[$langDefault]->sef;
  710. }
  711. }
  712. }
  713. return $frontIndexPath;
  714. }
  715. }