コード例 #1
0
 /**
  * System Event: onAfterInitialise
  *
  * Load JF Core Overrides 
  *
  * @return	string
  */
 public function onAfterInitialise()
 {
     if (JFactory::getApplication()->isSite() && !JoomfishExtensionHelper::isJoomFishActive()) {
         JError::raiseNotice('no_jf_extension', JText::_('JF_DATABASE_PLUGIN_NOT_PUBLISHED'));
     }
     $dbtype = JFactory::getConfig()->getValue('dbtype', 'mysqli');
     if ($dbtype != 'mysqli') {
         JError::raiseNotice('no_jf_extension', JText::_('JF_DATABASE_DRIVER_NOT_SUPPORTED'));
         return;
     }
     if (!defined('JFOVERRIDES_PLUGIN_LOCATION')) {
         define('JFOVERRIDES_PLUGIN_LOCATION', dirname(__FILE__));
     }
     if (JFactory::getApplication()->isAdmin()) {
         // remove *
         $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/language.php', 'JFormFieldLanguage');
         $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/contentlanguage.php', 'JFormFieldContentLanguage');
         // remove translated menus from root
         $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/adminmenuhelper.php', 'ModMenuHelper');
         // added pre-post save events
         $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/menusmodelitem.php', 'MenusModelItem');
         // home menu allow also default lang not just *
         $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/tablemenu.php', 'JTableMenu', true);
     } else {
         //JFactory::getApplication()->setLanguageFilter(false);
         jimport('joomla.application.menu');
         //JLoader::import('joomla.application.menu', JFOVERRIDES_PLUGIN_LOCATION.'/classes' );
         $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/menu.php', 'JMenuSite', true);
         JMenuSite::getInstance('site');
     }
 }
コード例 #2
0
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * -----------------------------------------------------------------------------

 * @package joomfish
 * @subpackage mod_jflanguageselection
 *
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
JLoader::register('JoomfishExtensionHelper', JPATH_ADMINISTRATOR . '/components/com_joomfish/helpers/extensionHelper.php');
jimport('joomfish.route.jfroute');
if (!JoomfishExtensionHelper::isJoomFishActive()) {
    return;
}
$db = JFactory::getDBO();
$db->_profile("langmod", true);
// Include the helper functions only once
JLoader::import('helper', dirname(__FILE__), 'jfmodule');
JLoader::register('JoomFishVersion', JOOMFISH_ADMINPATH . DS . 'version.php');
$type = trim($params->get('type', 'rawimages'));
$layout = JModuleHelper::getLayoutPath('mod_jflanguageselection', $type);
$inc_jf_css = intval($params->get('inc_jf_css', 1));
$type = trim($params->get('type', 'dropdown'));
$show_active = intval($params->get('show_active', 1));
$spacer = trim($params->get('spacer', ' '));
jimport('joomla.filesystem.file');
$jfManager = JoomFishManager::getInstance();
コード例 #3
0
 /**
  * Method to get information of site languages
  *
  * @return object
  * @since 1.5
  */
 static function getlanguageslist($published_only = false, $add_all = true)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     static $pub_languages = null;
     static $all_languages = null;
     if ($published_only) {
         if ($pub_languages) {
             return $pub_languages;
         } else {
             $pub_languages = false;
         }
     }
     if (!$published_only) {
         if ($all_languages) {
             return $all_languages;
         } else {
             $all_languages = false;
         }
     }
     // ******************
     // Retrieve languages
     // ******************
     if (FLEXI_J16GE) {
         // Use J1.6+ language info
         $query = 'SELECT DISTINCT lc.lang_id as id, lc.image as image_prefix, lc.lang_code as code, lc.title_native, ' . ' lc.title as name ' . ' FROM #__languages as lc ' . ' WHERE 1 ' . ($published_only ? ' AND lc.published=1' : '') . ' ORDER BY lc.ordering ASC ';
     } else {
         if (FLEXI_FISH) {
             // Use joomfish languages table
             $query = 'SELECT l.* ' . (FLEXI_FISH_22GE ? ', lext.* ' : '') . (FLEXI_FISH_22GE ? ', l.lang_id as id ' : ', l.id ') . (FLEXI_FISH_22GE ? ', l.lang_code as code, l.sef as shortcode' : ', l.code, l.shortcode') . (FLEXI_FISH_22GE ? ', CASE WHEN CHAR_LENGTH(l.title_native) THEN CONCAT(l.title, " (", l.title_native, ")") ELSE l.title END as name ' : ', l.name ') . ' FROM #__languages as l' . (FLEXI_FISH_22GE ? ' LEFT JOIN #__jf_languages_ext as lext ON l.lang_id=lext.lang_id ' : '') . ' WHERE ' . (FLEXI_FISH_22GE ? ' l.published=1 ' : ' l.active=1 ') . ' ORDER BY ' . (FLEXI_FISH_22GE ? ' lext.ordering ASC ' : ' l.ordering ASC ');
         } else {
             //echo "<pre>"; debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); echo "</pre>";
             //JError::raiseNotice(500, 'getlanguageslist(): Notice no joomfish installed');
             //return array();
         }
     }
     if (!empty($query)) {
         $db->setQuery($query);
         $languages = $db->loadObjectList('id');
         //echo "<pre>"; print_r($languages); echo "</pre>"; exit;
         if ($db->getErrorNum()) {
             JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
         }
     }
     // *********************
     // Calculate image paths
     // *********************
     if (FLEXI_J16GE) {
         // FLEXI_J16GE, use J1.6+ images
         $imgpath = $app->isAdmin() ? '../images/' : 'images/';
         $mediapath = $app->isAdmin() ? '../media/mod_languages/images/' : 'media/mod_languages/images/';
     } else {
         // Use joomfish images
         $imgpath = $app->isAdmin() ? '../images/' : 'images/';
         $mediapath = $app->isAdmin() ? '../components/com_joomfish/images/flags/' : 'components/com_joomfish/images/flags/';
     }
     // ************************
     // Prepare language objects
     // ************************
     $_languages = array();
     // J1.6+ add 'ALL' also add 'ALL' if no languages found, since this is default for J1.6+
     if (FLEXI_J16GE && $add_all) {
         $lang_all = new stdClass();
         $lang_all->code = '*';
         $lang_all->name = JText::_('FLEXI_ALL');
         $lang_all->shortcode = '*';
         $lang_all->id = 0;
         $_languages = array(0 => $lang_all);
     }
     // J1.5 add default site language if no languages found, e.g. no Joom!Fish installed
     if (!FLEXI_J16GE && empty($languages)) {
         $lang_default = new stdClass();
         $lang_default->code = flexicontent_html::getSiteDefaultLang();
         $lang_default->name = $lang_default->code;
         $lang_default->shortcode = strpos($lang_default->code, '-') ? substr($lang_default->code, 0, strpos($lang_default->code, '-')) : $lang_default->code;
         $lang_default->id = 0;
         $_languages = array(0 => $lang_default);
     }
     // Check if no languages found and return
     if (empty($languages)) {
         return $_languages;
     }
     if (FLEXI_J16GE) {
         foreach ($languages as $lang) {
             // Calculate/Fix languages data
             $lang->shortcode = strpos($lang->code, '-') ? substr($lang->code, 0, strpos($lang->code, '-')) : $lang->code;
             //$lang->id = $lang->extension_id;
             $image_prefix = $lang->image_prefix ? $lang->image_prefix : $lang->shortcode;
             // $lang->image, holds a custom image path
             $lang->imgsrc = @$lang->image ? $imgpath . $lang->image : $mediapath . $image_prefix . '.gif';
             $_languages[$lang->id] = $lang;
         }
         // Also prepend '*' (ALL) language to language array
         //echo "<pre>"; print_r($languages); echo "</pre>"; exit;
         // Select language -ALL- if none selected
         //$selected = $selected ? $selected : '*';    // WRONG behavior commented out
     } else {
         if (FLEXI_FISH_22GE) {
             require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_joomfish' . DS . 'helpers' . DS . 'extensionHelper.php';
             foreach ($languages as $lang) {
                 // Get image path via helper function
                 $_imgsrc = JoomfishExtensionHelper::getLanguageImageSource($lang);
                 $lang->imgsrc = JURI::root(true) . ($_imgsrc[0] != '/' ? '/' : '') . $_imgsrc;
                 $_languages[$lang->id] = $lang;
             }
         } else {
             foreach ($languages as $lang) {
                 // $lang->image, holds a custom image path
                 $lang->imgsrc = @$lang->image ? $imgpath . $lang->image : $mediapath . $lang->shortcode . '.gif';
                 $_languages[$lang->id] = $lang;
             }
         }
     }
     $languages = $_languages;
     if ($published_only) {
         $pub_languages = $_languages;
     } else {
         $all_languages = $_languages;
     }
     return $_languages;
 }
コード例 #4
0
ファイル: default.php プロジェクト: raulrotundo/jpmoser_guide
    ?>
 value="<?php 
    echo $language->lang_id;
    ?>
" /></td>
						<td><input type="text" name="sef[]" value="<?php 
    echo $language->sef;
    ?>
" maxlength="10" /></td>
						<td><input type="text" name="fallbackCode[]" value="<?php 
    echo $language->fallback_code;
    ?>
" maxlength="20" /></td>
						<td nowrap="nowrap">
				      		<?php 
    $src = JoomfishExtensionHelper::getLanguageImageSource($language);
    ?>
							<img src="<?php 
    echo $src != '' ? $src : JURI::base() . 'images/blank.png';
    ?>
" alt="<?php 
    echo html_entity_decode($src);
    ?>
" title="<?php 
    echo $language->title;
    ?>
" class="flag" id="flagImage<?php 
    echo $i;
    ?>
" />
				      		<input id="flagValue<?php 
コード例 #5
0
ファイル: view.php プロジェクト: RangerWalt/ecci
 /**
  * Method to determine the correct image path for language flags.
  * The works as the standard JHTMLImage method except that it uses always the live site basic as URL
  *
  * @param unknown_type $language
  * @param unknown_type $altFile
  * @param unknown_type $altFolder
  * @param unknown_type $alt
  * @param unknown_type $attribs
  * @return string	image path
  */
 function languageImage($language, $alt = NULL, $attribs = '')
 {
     $src = JoomfishExtensionHelper::getLanguageImageSource($language);
     return '<img src="' . JURI::root() . $src . '" alt="' . html_entity_decode($alt) . '" ' . $attribs . ' />';
 }
コード例 #6
0
ファイル: helper.php プロジェクト: RangerWalt/ecci
 /**
  * Returns the language image based on the standard media folder (as configured in the component) or template information
  * The component parameters will be used as folder path within the template or starting with the root directory of your site
  * If the image is found in the current template + folder this reference is returned. Otherwise the reference from
  * JPATH_SITE + folder. The reference is not verified if the image exists!
  *  
  * @param	$language	JFLnaguage language object including the detailed information
  * @return	string		Path to the image found
  */
 function getLanguageImageSource($language)
 {
     return JoomfishExtensionHelper::getLanguageImageSource($language);
 }
コード例 #7
0
ファイル: extensionHelper.php プロジェクト: RangerWalt/ecci
 /**
  * Returns the language image based on the standard media folder (as configured in the component) or template information
  * The component parameters will be used as folder path within the template or starting with the root directory of your site
  * If the image is found in the current template + folder this reference is returned. Otherwise the reference from
  * JPATH_SITE + folder. The reference is not verified if the image exists!
  *  
  * @param	$language	JFLnaguage language object including the detailed information
  * @return	string		Path to the image found
  */
 public static function getLanguageImageSource($language)
 {
     global $mainframe;
     $params = JComponentHelper::getParams('com_joomfish');
     $media = $params->get('directory_flags', 'components/com_joomfish/images');
     $cur_template = $mainframe->getTemplate();
     $folder = '';
     $file = '';
     if (!empty($language->image)) {
         $file = basename($language->image);
         $folder = dirname($language->image);
     } elseif (!empty($language->shortcode)) {
         $file = $language->shortcode . '.gif';
         $folder = 'flags';
     } else {
         return '';
     }
     if (!self::$imagePath) {
         self::$imagePath = array();
     }
     // check template path first
     $path = $folder != '' ? $folder . '/' . $file : $file;
     if (!isset(self::$imagePath[$path])) {
         jimport('joomla.filesystem.file');
         if (JFile::exists(JPATH_SITE . '/templates/' . $cur_template . '/' . $path)) {
             self::$imagePath[$path] = '/templates/' . $cur_template . '/' . $path;
         } elseif (JFile::exists(JPATH_SITE . DS . $path)) {
             self::$imagePath[$path] = $path;
         } elseif (JFile::exists(JPATH_SITE . DS . $media . DS . $path)) {
             self::$imagePath[$path] = $media . DS . $path;
         } else {
             self::$imagePath[$path] = $path;
         }
     }
     return self::$imagePath[$path];
 }
コード例 #8
0
 /**
  * Returns the language image based on the standard media folder (as configured in the component) or template information
  * The component parameters will be used as folder path within the template or starting with the root directory of your site
  * If the image is found in the current template + folder this reference is returned. Otherwise the reference from
  * JPATH_SITE + folder. The reference is not verified if the image exists!
  *  
  * @param	$language	JFLnaguage language object including the detailed information
  * @return	string		Path to the image found
  */
 public static function getLanguageImageSource($language)
 {
     $params = JComponentHelper::getParams('com_joomfish');
     $media = $params->get('directory_flags', 'media/mod_languages/images');
     $cur_template = JFactory::getApplication()->getTemplate();
     $folder = '';
     $file = '';
     if (!empty($language->image_ext)) {
         $file = basename($language->image_ext);
         $folder = dirname($language->image_ext);
     } elseif (!empty($language->image)) {
         $file = $language->image . '.gif';
         $folder = '';
     } elseif (!empty($language->sef)) {
         $file = $language->sef . '.gif';
         $folder = '';
     } else {
         return '';
     }
     if (!self::$imagePath) {
         self::$imagePath = array();
     }
     // check template path first
     $path = $folder != '' ? $folder . '/' . $file : $file;
     if (!isset(self::$imagePath[$path])) {
         jimport('joomla.filesystem.file');
         if (JFile::exists(JPATH_SITE . '/templates/' . $cur_template . '/' . $path)) {
             self::$imagePath[$path] = '/templates/' . $cur_template . '/' . $path;
         } elseif (JFile::exists(JPATH_SITE . DS . $path)) {
             self::$imagePath[$path] = $path;
         } elseif (JFile::exists(JPATH_SITE . DS . $media . DS . $path)) {
             self::$imagePath[$path] = $media . '/' . $path;
         } else {
             self::$imagePath[$path] = $path;
         }
     }
     return ltrim(self::$imagePath[$path], '/');
 }