From: <du...@us...> - 2012-11-07 16:18:38
|
Revision: 10249 http://sourceforge.net/p/xoops/svn/10249 Author: dugris Date: 2012-11-07 16:18:31 +0000 (Wed, 07 Nov 2012) Log Message: ----------- Add help Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/help.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/help.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help.php Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/help.css =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/help.css (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/help.css 2012-11-07 16:18:31 UTC (rev 10249) @@ -0,0 +1,45 @@ +code { + display: block; + width: 90%; + max-height: 400px; + overflow: auto; + padding: 2em; + font-weight: bold; + font-size: 1em; +} +.system-help { + min-height: 650px; +} +.help { + height: 100px; + display: block; +} +.help-item { + margin-bottom: 20px; + display: blockj; +} +.help-title { + width: 80%; + margin-bottom: 10px; + font-size: 1.2em; + font-weight: bold; +} +.help-paypal { + vertical-align: top; + margin: 0; + padding: 0; +} + +.help-submenu { + margin: 10px; + padding: 10px; + background-color: #F7F7F9; + width: 250px; + position: absolute; + right: 50px; +} + +.help-description { + width: 100%; + +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help ___________________________________________________________________ Added: tsvn:autoprops + *.php = svn:executable=*;svn:keywords=Author Date Id Rev URL; Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/help.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/help.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/help.html 2012-11-07 16:18:31 UTC (rev 10249) @@ -0,0 +1,93 @@ +<link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl modules/xlanguage/css/help.css}>" /> + +<div class="help txtcenter"> + <div class="help-submenu floatright txtleft"> + <ul> + <li><a href="#description" title=""><{$smarty.const._HELP_DESCRIPTION_TITLE}></a></li> + <li><a href="#developer" title=""><{$smarty.const._HELP_DEVELOPER_TITLE}></a></li> + <li><a href="#install" title=""><{$smarty.const._HELP_INSTALL_TITLE}></a></li> +<!-- + <li><a href="#uninstall" title=""><{$smarty.const._HELP_UNINSTALL_TITLE}></a></li> +--> + <li><a href="#tutorial" title=""><{$smarty.const._HELP_TUTORIAL_TITLE}></a></li> + </ul> + </div> + + <div class="floatleft"> + <img src="<{$xoops_url}>/modules/<{$module->getVar('dirname')}>/<{$module->getInfo('image')}>" alt="<{$module->getVar('name')}>" title="<{$module->getVar('name')}>" /> + </div> + + <div class="help-title floaleft"> + <h2><{$module->getVar('name')}></h2> + <{if $module->getInfo('paypal')}> + <form class="help-paypal" id="paypal-form" name="_xclick" action="https://www.paypal.com/fr/cgi-bin/webscr" method="post"> + <input type="hidden" name="cmd" value="_xclick"> + <{foreachq from=$module->getInfo('paypal') item=value key=key}> + <{if is_numeric($value)}> + <input type="hidden" name="<{$key}>" value=<{$value}>> + <{else}> + <input type="hidden" name="<{$key}>" value="<{$value}>"> + <{/if}> + <{/foreach}> + <img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" onclick="$('#paypal-form').submit()" alt="PayPal - The safer, easier way to pay online!" /> + </form> + <{/if}> + </div> +</div> +<div class="clear"></div> + +<a name="description"></a> +<div class="help-item"> + <div class="help-title"> + <{$smarty.const._HELP_DESCRIPTION_TITLE}> + </div> + <div> + <{$module->getInfo('description')}> + <br /> + Version : <{$module->getInfo('version')}> <{$module->getInfo('module_status')}> (<{$module->getInfo('release_date')}>)</div> + </div> +</div> + +<a name="Developer"></a> +<div class="help-item"> + <div class="help-title"> + <{$smarty.const._HELP_DEVELOPER_TITLE}> + </div> + <{if $module->getInfo('module_website_url')}> + <div class="spacer marg5"> + <a href="http://<{$module->getInfo('module_website_url')}>" rel="external"><{$module->getInfo('module_website_name')}></a> + </div> + <{/if}> +</div> + +<a name="install"></a> +<div class="help-item"> + <div class="help-title"> + <{$smarty.const._HELP_INSTALL_TITLE}> + </div> + <div> + <{$smarty.const._HELP_INSTALL_CONTENT}> + </div> +</div> + +<!-- +<a name="uninstall"></a> +<div class="help-item"> + <div class="help-title"> + <{$smarty.const._HELP_UNINSTALL_TITLE}> + </div> + <div> + <{$smarty.const._HELP_UNINSTALL_CONTENT}> + </div> +</div> +--> + +<a name="tutorial"></a> +<div class="help-item"> + <div class="help-title"> + <{$smarty.const._HELP_TUTORIAL_TITLE}> + </div> + <div> + <{$smarty.const._HELP_TUTORIAL_CONTENT}> + </div> +</div> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/index.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help/index.html 2012-11-07 16:18:31 UTC (rev 10249) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help.php 2012-11-07 16:18:31 UTC (rev 10249) @@ -0,0 +1,39 @@ +<?php +/** + * Xoocontact module + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package xoocontact + * @since 2.6.0 + * @author Laurent JEN (Aka DuGris) + * @version $Id$ + */ + +define("_HELP_DESCRIPTION_TITLE", "Description"); +define("_HELP_DEVELOPER_TITLE", "Developer"); + +define("_HELP_INSTALL_TITLE", "Install"); +define("_HELP_INSTALL_CONTENT", " +Extra, or non-core, modules are usually downloadable as compressed files (zip, tar). Always check if a text file with upload instructions is included in the downloaded package. + <ol> + <li> Unzip files in local computer.</li> + <li>FTP/upload all files to appropriate folders in your website directory. This is usually the /modules folder under the Xoops root directory, where all the other modules are found. However, some modules have extra files that need to be uploaded to other folders such as the /include and the /class folders.</li> + <li>After upload, go to your Modules Administration Page and check if the new module is included in the uninstalled modules table.</li> + <li>Follow the steps described above for installing core modules from the Modules Administration page.</li> + </ol> +"); + +define("_HELP_UNINSTALL_TITLE", "Uninstall"); +define("_HELP_UNINSTALL_CONTENT", ""); + +define("_HELP_TUTORIAL_TITLE", "Tutorial"); +define("_HELP_TUTORIAL_CONTENT", "Coming soon"); +?> \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/help.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL |
From: <du...@us...> - 2012-11-18 22:30:42
|
Revision: 10255 http://sourceforge.net/p/xoops/svn/10255 Author: dugris Date: 2012-11-18 22:30:39 +0000 (Sun, 18 Nov 2012) Log Message: ----------- Fiw form, install, update Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/xoops_version.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/install/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/install/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/install/install.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/install/update.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php 2012-11-15 06:59:03 UTC (rev 10254) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php 2012-11-18 22:30:39 UTC (rev 10255) @@ -44,16 +44,18 @@ case 'add': $lang = $xlanguage_handler->create(); - $admin_page->addInfoBox(_MI_XLANGUAGE_ADD_LANG); - $admin_page->addInfoBoxLine($lang->getForm()); + $form = $xoops->getModuleForm($lang, 'language', 'xlanguage'); + $admin_page->addInfoBox(_MI_XLANGUAGE_MODIFY); + $admin_page->addInfoBoxLine( $form->render() ); break; case 'edit': $xlanguage_id = $system->CleanVars($_REQUEST, 'xlanguage_id', 0, 'int'); if( isset($xlanguage_id) && $xlanguage_id > 0 ){ if ($lang = $xlanguage_handler->get($xlanguage_id) ) { + $form = $xoops->getModuleForm($lang, 'language', |
From: <tr...@us...> - 2012-12-02 17:33:01
|
Revision: 10301 http://sourceforge.net/p/xoops/svn/10301 Author: trabis Date: 2012-12-02 17:32:55 +0000 (Sun, 02 Dec 2012) Log Message: ----------- Updating/fixing xlanguage for 2.6 Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/about.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/footer.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/menu.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/autoload.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/functions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/vars.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/about.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/about.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/about.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -19,6 +19,7 @@ include dirname(__FILE__) . '/header.php'; +$xoops = Xoops::getInstance(); $xoops->header(); $xoops->theme->addStylesheet('modules/xcontact/css/moduladmin.css'); @@ -26,5 +27,4 @@ $admin_page->renderNavigation('about.php'); $admin_page->renderAbout(); -$xoops->footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/footer.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/footer.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/footer.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -17,6 +17,6 @@ * @version $Id$ */ +$xoops = Xoops::getInstance(); $admin_page->renderIndex(); -$xoops->footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -20,13 +19,13 @@ include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; $op = ''; -if ( isset( $_POST ) ){ - foreach ( $_POST as $k => $v ) { +if (isset($_POST)) { + foreach ($_POST as $k => $v) { ${$k} = $v; } } -if ( isset( $_GET ) ){ - foreach ( $_GET as $k => $v ) { +if (isset($_GET)) { + foreach ($_GET as $k => $v) { ${$k} = $v; } } @@ -42,5 +41,4 @@ $xoops->header(); $xoops->theme->addStylesheet('modules/xlanguage/css/moduladmin.css'); -$admin_page = new XoopsModuleAdmin(); -?> \ No newline at end of file +$admin_page = new XoopsModuleAdmin(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -19,24 +19,25 @@ include dirname(__FILE__) . '/header.php'; +$xoops = Xoops::getInstance(); $xoops->header(); -switch ( $op ) { +switch ( $op ) { case 'save': - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('index.php', 5, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + if ( !$xoops->security->check() ) { + $xoops->redirect('index.php', 5, implode(',', $xoops->security->getErrors())); } $xlanguage_id = $system->CleanVars($_POST, 'xlanguage_id', 0, 'int'); - if( isset($xlanguage_id) && $xlanguage_id > 0 ){ + if( isset($xlanguage_id) && $xlanguage_id > 0 ){ $lang = $xlanguage_handler->get($xlanguage_id); - } else { + } else { $lang = $xlanguage_handler->create(); } $lang->CleanVarsForDB(); - if ($xlanguage_handler->insert($lang)) { + if ($xlanguage_handler->insert($lang)) { $xlanguage_handler->createConfig(); $xoops->redirect('index.php', 5, _AM_XLANGUAGE_SAVED); } @@ -51,15 +52,15 @@ case 'edit': $xlanguage_id = $system->CleanVars($_REQUEST, 'xlanguage_id', 0, 'int'); - if( isset($xlanguage_id) && $xlanguage_id > 0 ){ - if ($lang = $xlanguage_handler->get($xlanguage_id) ) { + if( isset($xlanguage_id) && $xlanguage_id > 0 ){ + if ($lang = $xlanguage_handler->get($xlanguage_id) ) { $form = $xoops->getModuleForm($lang, 'language', 'xlanguage'); $admin_page->addInfoBox(_MI_XLANGUAGE_MODIFY); $admin_page->addInfoBoxLine( $form->render() ); - } else { - $xoops->redirect('index.php', 5); + } else { + $xoops->redirect('index.php', 5); } - } else { + } else { $xoops->redirect('index.php', 5); } break; @@ -67,16 +68,16 @@ case 'del': $xlanguage_id = $system->CleanVars($_REQUEST, 'xlanguage_id', 0, 'int'); if( isset($xlanguage_id) && $xlanguage_id > 0 ){ - if ($lang = $xlanguage_handler->get($xlanguage_id) ) { + if ($lang = $xlanguage_handler->get($xlanguage_id) ) { $delete = $system->CleanVars( $_POST, 'ok', 0, 'int' ); - if ($delete == 1) { - if ( !$GLOBALS['xoopsSecurity']->check() ) { + if ($delete == 1) { + if ( !$xoops->security->check() ) { $xoops->redirect('index.php', 5, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } $xlanguage_handler->delete($lang); $xlanguage_handler->createConfig(); $xoops->redirect('index.php', 5, _AM_XLANGUAGE_DELETED); - } else { + } else { ob_start(); $xoops->confirm(array('ok' => 1, 'xlanguage_id' => $xlanguage_id, 'op' => 'del'), $_SERVER['REQUEST_URI'], sprintf(_AM_XLANGUAGE_DELETE_CFM . "<br /><b><span style='color : Red'> %s </span></b><br /><br />", $lang->getVar('xlanguage_name'))); $confirm = '<div class="confirm">' . ob_get_contents() . '</div>'; @@ -84,10 +85,10 @@ $admin_page->addInfoBox(_MI_XLANGUAGE_DELETE); $admin_page->addInfoBoxLine($confirm); } - } else { + } else { $xoops->redirect('index.php', 5); } - } else { + } else { $xoops->redirect('index.php', 5); } break; @@ -104,4 +105,3 @@ break; } include dirname(__FILE__) . '/footer.php'; -?> Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/menu.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/menu.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/menu.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -35,5 +35,4 @@ $cpt++; $adminmenu[$cpt]['title'] = _MI_XLANGUAGE_ABOUT; $adminmenu[$cpt]['link'] = 'admin/about.php'; -$adminmenu[$cpt]['icon'] = 'about.png'; -?> \ No newline at end of file +$adminmenu[$cpt]['icon'] = 'about.png'; \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -17,17 +16,19 @@ * @version $Id$ */ -global $xoops, $xlanguage; +$xoops = Xoops::getInstance(); +$xlanguage = array(); + include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php'; include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php'; -$cookie_var = XLANGUAGE_LANG_TAG; +$cookie_var = $xoops->registry->get('XLANGUAGE_LANG_TAG'); $xlanguage['action'] = false; -if (!empty($_GET[XLANGUAGE_LANG_TAG])) { +if (!empty($_GET[$xoops->registry->get('XLANGUAGE_LANG_TAG')])) { $cookie_path = '/'; - setcookie($cookie_var, $_GET[XLANGUAGE_LANG_TAG], time()+3600*24*30, $cookie_path, '', 0); - $xlanguage['lang'] = $_GET[XLANGUAGE_LANG_TAG]; + setcookie($cookie_var, $_GET[$xoops->registry->get('XLANGUAGE_LANG_TAG')], time() + 3600 * 24 * 30, $cookie_path, '', 0); + $xlanguage['lang'] = $_GET[$xoops->registry->get('XLANGUAGE_LANG_TAG')]; } elseif (!empty($_COOKIE[$cookie_var])) { $xlanguage['lang'] = $_COOKIE[$cookie_var]; } elseif ($lang = xlanguage_detectLang()) { @@ -41,29 +42,29 @@ $lang = $xlanguage_handler->getByName($xlanguage['lang']); -if ( is_array($lang) && strcasecmp($lang['xlanguage_name'], $xoops->getConfig('language')) ) { +if (is_array($lang) && strcasecmp($lang['xlanguage_name'], $xoops->getConfig('language'))) { $xoops->setConfig('language', $lang['xlanguage_name']); - if ( $lang['xlanguage_charset'] ) { + if ($lang['xlanguage_charset']) { $xlanguage['charset'] = $lang['xlanguage_charset']; } - if ( $lang['xlanguage_code'] ) { + if ($lang['xlanguage_code']) { $xlanguage['code'] = $lang['xlanguage_code']; } } unset($lang); -$GLOBALS['xlanguage_handler'] = $xlanguage_handler; +$xoops->registry->set('XLANGUAGE_HANDLER', $xlanguage_handler); -if ( $xlanguage['action'] ) { +if ($xlanguage['action']) { //if(CONV_REQUEST && (!empty($_GET)||!empty($_POST))){ - if ( !empty($_POST) ) { + if (!empty($_POST)) { $in_charset = $xlanguage['charset']; $out_charset = $xlanguage['charset_base']; //$CONV_REQUEST_array=array('_GET', '_POST'); - $CONV_REQUEST_array=array('_POST'); - foreach ( $CONV_REQUEST_array as $HV ) { - if ( !empty(${$HV}) ) { + $CONV_REQUEST_array = array('_POST'); + foreach ($CONV_REQUEST_array as $HV) { + if (!empty(${$HV})) { ${$HV} = xlanguage_convert_encoding(${$HV}, $out_charset, $in_charset); } $GLOBALS['HTTP' . $HV . '_VARS'] = ${$HV}; @@ -74,11 +75,4 @@ ob_start('xlanguage_ml'); } -/* - * hardcoded scripts for language switching in theme html files - * - * see include/vars.php - */ - - -?> \ No newline at end of file +$xoops->registry->set('XLANGUAGE', $xlanguage); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -17,57 +16,57 @@ * @version $Id$ */ - function b_xlanguage_select_show($options) -{ - global $xlanguage; - $xoops = Xoops::getInstance(); +{ + $xoops = Xoops::getInstance(); + $xlanguage = $xoops->registry->get('XLANGUAGE'); + $lang_tag = $xoops->registry->get('XLANGUAGE_LANG_TAG'); - $options[3] = $xoops->getModuleConfig('theme', 'xlanguage'); + $options[3] = $xoops->getModuleConfig('theme', 'xlanguage'); $block = array(); - $xlanguage_handler = $xoops->getModuleHandler('xlanguage', 'xlanguage'); - $xlanguage_handler->loadConfig(); + $xlanguage_handler = $xoops->getModuleHandler('xlanguage', 'xlanguage'); + $xlanguage_handler->loadConfig(); - if ( !is_array($xlanguage_handler->cached_config) || count($xlanguage_handler->cached_config)<1 ) { - return $block; + if (!is_array($xlanguage_handler->cached_config) || count($xlanguage_handler->cached_config) < 1) { + return $block; } - $QUERY_STRING_array = array_filter(explode('&',$xoops->getEnv('QUERY_STRING'))); - $QUERY_STRING_new = array(); - foreach ( $QUERY_STRING_array as $QUERY ) { - if ( substr($QUERY, 0, (strlen(XLANGUAGE_LANG_TAG)+1)) != XLANGUAGE_LANG_TAG . '=' ) { - $vals = explode('=', $QUERY); - foreach ( array_keys($vals) as $key ) { - if ( preg_match('/^a-z0-9$/i', $vals[$key]) ) { - $vals[$key] = urlencode($vals[$key]); - } - } - $QUERY_STRING_new[] = implode('=', $vals); - } - } + $QUERY_STRING_array = array_filter(explode('&', $xoops->getEnv('QUERY_STRING'))); + $QUERY_STRING_new = array(); + foreach ($QUERY_STRING_array as $QUERY) { + if (substr($QUERY, 0, (strlen($lang_tag) + 1)) != $lang_tag . '=') { + $vals = explode('=', $QUERY); + foreach (array_keys($vals) as $key) { + if (preg_match('/^a-z0-9$/i', $vals[$key])) { + $vals[$key] = urlencode($vals[$key]); + } + } + $QUERY_STRING_new[] = implode('=', $vals); + } + } - $block['display'] = $options[0]; - $block['delimitor'] = $options[1]; - $block['number'] = $options[2]; + $block['display'] = $options[0]; + $block['delimitor'] = $options[1]; + $block['number'] = $options[2]; - $block['selected'] = $xlanguage['lang']; + $block['selected'] = $xlanguage['lang']; - if ( $options[0] == 'images' || $options[0] == 'text' ) { - $query_string = htmlSpecialChars(implode('&', $QUERY_STRING_new)); - $query_string .= empty($query_string) ? '' : '&'; - } else { - $query_string = implode('&', array_map('htmlspecialchars', $QUERY_STRING_new)); - $query_string .= empty($query_string) ? '' : '&'; - } - $block['url'] = $xoops->getEnv('PHP_SELF') . '?' . $query_string . XLANGUAGE_LANG_TAG . '='; + if ($options[0] == 'images' || $options[0] == 'text') { + $query_string = htmlSpecialChars(implode('&', $QUERY_STRING_new)); + $query_string .= empty($query_string) ? '' : '&'; + } else { + $query_string = implode('&', array_map('htmlspecialchars', $QUERY_STRING_new)); + $query_string .= empty($query_string) ? '' : '&'; + } + $block['url'] = $xoops->getEnv('PHP_SELF') . '?' . $query_string . $lang_tag . '='; $block['languages'] = $xlanguage_handler->cached_config; - return $block; + return $block; } function b_xlanguage_select_edit($options) -{ +{ $block_form = new XoopsFormElementTray(' ', '<br />'); $tmp = new XoopsFormSelect(_MB_XLANGUAGE_DISPLAY_METHOD . ' : ', 'options[0]', $options[0]); @@ -78,9 +77,8 @@ $tmp->addOption('bootstrap', _MB_XLANGUAGE_DISPLAY_BOOTSTRAP); $block_form->addElement($tmp); - $block_form->addElement(new XoopsFormText(_MB_XLANGUAGE_IMAGE_SEPARATOR . ' (' . _MB_XLANGUAGE_OPTIONAL . ') : ', 'options[1]', 5, 5, $options[1] )); - $block_form->addElement(new XoopsFormText(_MB_XLANGUAGE_IMAGE_PERROW . ' (' . _MB_XLANGUAGE_OPTIONAL . ') : ', 'options[2]', 2, 2, $options[2] )); + $block_form->addElement(new XoopsFormText(_MB_XLANGUAGE_IMAGE_SEPARATOR . ' (' . _MB_XLANGUAGE_OPTIONAL . ') : ', 'options[1]', 5, 5, $options[1])); + $block_form->addElement(new XoopsFormText(_MB_XLANGUAGE_IMAGE_PERROW . ' (' . _MB_XLANGUAGE_OPTIONAL . ') : ', 'options[2]', 2, 2, $options[2])); - return $block_form->render(); -} -?> \ No newline at end of file + return $block_form->render(); +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -31,48 +30,48 @@ /** * Maintenance Form + * * @return void */ public function LanguageForm() - { + { $xoops = Xoops::getInstance(); parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal'); // language name - $xlanguage_select = new XoopsFormSelect(_AM_XLANGUAGE_NAME, 'xlanguage_name', $this->xoopsObject->getVar('xlanguage_name')); + $xlanguage_select = new XoopsFormSelect(_AM_XLANGUAGE_NAME, 'xlanguage_name', $this->xoopsObject->getVar('xlanguage_name')); $xlanguage_select->addOptionArray(XoopsLists::getLangList()); $this->addElement($xlanguage_select, true); // language description - $this->addElement(new XoopsFormText(_AM_XLANGUAGE_DESCRIPTION, 'xlanguage_description', 5, 10, $this->xoopsObject->getVar('xlanguage_description') ), true); + $this->addElement(new XoopsFormText(_AM_XLANGUAGE_DESCRIPTION, 'xlanguage_description', 5, 10, $this->xoopsObject->getVar('xlanguage_description')), true); // language charset - $autoload = XoopsLoad::loadConfig( 'xlanguage' ); + $autoload = XoopsLoad::loadConfig('xlanguage'); $charset_select = new XoopsFormSelect(_AM_XLANGUAGE_CHARSET, 'xlanguage_charset', $this->xoopsObject->getVar('xlanguage_charset')); $charset_select->addOptionArray($autoload['charset']); $this->addElement($charset_select); // language code - $this->addElement(new XoopsFormText(_AM_XLANGUAGE_CODE, 'xlanguage_code', 5, 10, $this->xoopsObject->getVar('xlanguage_code') ), true); + $this->addElement(new XoopsFormText(_AM_XLANGUAGE_CODE, 'xlanguage_code', 5, 10, $this->xoopsObject->getVar('xlanguage_code')), true); // language weight - $this->addElement(new XoopsFormText(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 5, 10, $this->xoopsObject->getVar('xlanguage_weight') )); + $this->addElement(new XoopsFormText(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 5, 10, $this->xoopsObject->getVar('xlanguage_weight'))); - // language image $image_option_tray = new XoopsFormElementTray(_AM_XLANGUAGE_IMAGE, ''); $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/media/xoops/images/flags/' . $xoops->getModuleConfig('theme', 'xlanguage') . '/'); - $image_select = new XoopsFormSelect('', 'xlanguage_image', $this->xoopsObject->getVar('xlanguage_image')); + $image_select = new XoopsFormSelect('', 'xlanguage_image', $this->xoopsObject->getVar('xlanguage_image')); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image\", \"xlanguage_image\", \"/media/xoops/images/flags/" . $xoops->getModuleConfig('theme', 'xlanguage') . "/\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray('', ' '); $image_tray->addElement($image_select); - $image_tray->addElement(new XoopsFormLabel('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . XOOPS_URL . "/media/xoops/images/flags/" . $xoops->getModuleConfig('theme', 'xlanguage') . "/" . $this->xoopsObject->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>")); + $image_tray->addElement(new XoopsFormLabel('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . XOOPS_URL . "/media/xoops/images/flags/" . $xoops->getModuleConfig('theme', 'xlanguage') . "/" . $this->xoopsObject->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>")); $image_option_tray->addElement($image_tray); $this->addElement($image_option_tray); - $this->addElement(new XoopsFormHidden('xlanguage_id', $this->xoopsObject->getVar('xlanguage_id') )); + $this->addElement(new XoopsFormHidden('xlanguage_id', $this->xoopsObject->getVar('xlanguage_id'))); $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormHidden('op', 'save')); @@ -86,7 +85,7 @@ } public function render() - { + { $this->LanguageForm(); ob_start(); parent::render(); @@ -94,5 +93,4 @@ ob_end_clean(); return $ret; } -} -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -22,26 +21,21 @@ include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php'; class Xlanguage extends XoopsObject -{ +{ public function __construct() - { - $this->initVar('xlanguage_id' , XOBJ_DTYPE_INT , 0 , false, 10); - $this->initVar('xlanguage_name' , XOBJ_DTYPE_TXTBOX , '' , false); - $this->initVar('xlanguage_description' , XOBJ_DTYPE_TXTBOX , '' , false); - $this->initVar('xlanguage_code' , XOBJ_DTYPE_TXTBOX , '' , false); - $this->initVar('xlanguage_charset' , XOBJ_DTYPE_TXTBOX , '' , false); - $this->initVar('xlanguage_image' , XOBJ_DTYPE_TXTBOX , 'english.png' , false); - $this->initVar('xlanguage_weight' , XOBJ_DTYPE_INT , 1 , false, 10); - } - - public function Xlanguage() { - $this->__construct(); + $this->initVar('xlanguage_id', XOBJ_DTYPE_INT, 0, false, 10); + $this->initVar('xlanguage_name', XOBJ_DTYPE_TXTBOX, '', false); + $this->initVar('xlanguage_description', XOBJ_DTYPE_TXTBOX, '', false); + $this->initVar('xlanguage_code', XOBJ_DTYPE_TXTBOX, '', false); + $this->initVar('xlanguage_charset', XOBJ_DTYPE_TXTBOX, '', false); + $this->initVar('xlanguage_image', XOBJ_DTYPE_TXTBOX, 'english.png', false); + $this->initVar('xlanguage_weight', XOBJ_DTYPE_INT, 1, false, 10); } public function toArray() - { - global $xoops; + { + $xoops = Xoops::getInstance(); $ret = parent::toArray(); $ret['xlanguage_image'] = XOOPS_URL . '/media/xoops/images/flags/' . $xoops->getModuleConfig('theme', 'xlanguage') . '/' . $this->getVar('xlanguage_image'); return $ret; @@ -50,20 +44,20 @@ public function CleanVarsForDB() { global $system; - foreach ( $this->getValues() as $k => $v ) { - if ( $k != 'dohtml' ) { - if ( $this->vars[$k]['data_type'] == XOBJ_DTYPE_STIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_MTIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_LTIME) { + foreach ($this->getValues() as $k => $v) { + if ($k != 'dohtml') { + if ($this->vars[$k]['data_type'] == XOBJ_DTYPE_STIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_MTIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_LTIME) { $value = $system->CleanVars($_POST[$k], 'date', date('Y-m-d'), 'date') + $system->CleanVars($_POST[$k], 'time', date('u'), 'int'); - $this->setVar( $k, isset( $_POST[$k] ) ? $value : $v ); - } elseif ( $this->vars[$k]['data_type'] == XOBJ_DTYPE_INT ) { + $this->setVar($k, isset($_POST[$k]) ? $value : $v); + } elseif ($this->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { $value = $system->CleanVars($_POST, $k, $v, 'int'); - $this->setVar( $k, $value ); - } elseif ( $this->vars[$k]['data_type'] == XOBJ_DTYPE_ARRAY ) { + $this->setVar($k, $value); + } elseif ($this->vars[$k]['data_type'] == XOBJ_DTYPE_ARRAY) { $value = $system->CleanVars($_POST, $k, $v, 'array'); - $this->setVar( $k, $value ); + $this->setVar($k, $value); } else { $value = $system->CleanVars($_POST, $k, $v, 'string'); - $this->setVar( $k, $value ); + $this->setVar($k, $value); } } } @@ -72,7 +66,6 @@ class XlanguageXlanguageHandler extends XoopsPersistableObjectHandler { - public function __construct(&$db) { parent::__construct($db, 'xlanguage', 'Xlanguage', 'xlanguage_id', 'xlanguage_name'); @@ -80,14 +73,15 @@ public function loadConfig() { + $xoops = Xoops::getInstance(); $this->configPath = XOOPS_VAR_PATH . '/configs/xlanguage/'; - $this->configFile = XLANGUAGE_CONFIG_FILE; + $this->configFile = $xoops->registry->get('XLANGUAGE_CONFIG_FILE'); $this->configFileExt = '.php'; $this->cached_config = $this->loadFileConfig(); } public function loadFileConfig() - { + { $cached_config = $this->readConfig(); if (empty($cached_config)) { $cached_config = $this->createConfig(); @@ -106,7 +100,7 @@ public function createConfig() { $cached_config = array(); - foreach ( $this->getAllLanguage( false ) as $key => $language ) { + foreach ($this->getAllLanguage(false) as $key => $language) { $cached_config[$language['xlanguage_name']] = $language; } $this->writeConfig($cached_config); @@ -115,28 +109,28 @@ public function writeConfig($data) { - if ($this->CreatePath($this->configPath) ) { + if ($this->CreatePath($this->configPath)) { $path_file = $this->configPath . $this->configFile . $this->configFileExt; XoopsLoad::load('XoopsFile'); $file = XoopsFile::getHandler('file', $path_file); - return $file->write( "return " . var_export($data, true) . ";"); + return $file->write("return " . var_export($data, true) . ";"); } } - private function CreatePath( $pathname, $pathout = XOOPS_ROOT_PATH ) + private function CreatePath($pathname, $pathout = XOOPS_ROOT_PATH) { $xoops = Xoops::getInstance(); - $pathname = substr( $pathname, strlen(XOOPS_ROOT_PATH) ); - $pathname = str_replace( DIRECTORY_SEPARATOR, '/', $pathname ); + $pathname = substr($pathname, strlen(XOOPS_ROOT_PATH)); + $pathname = str_replace(DIRECTORY_SEPARATOR, '/', $pathname); $dest = $pathout; - $paths = explode( '/', $pathname ); + $paths = explode('/', $pathname); - foreach ( $paths as $path ) { - if ( !empty( $path ) ) { + foreach ($paths as $path) { + if (!empty($path)) { $dest = $dest . '/' . $path; - if ( !is_dir( $dest ) ) { - if ( !mkdir( $dest , 0755 ) ) { + if (!is_dir($dest)) { + if (!mkdir($dest, 0755)) { return false; } else { $this->WriteIndex($xoops->path('uploads'), 'index.html', $dest); @@ -147,54 +141,51 @@ return true; } - private function WriteIndex( $folder_in, $source_file, $folder_out ) + private function WriteIndex($folder_in, $source_file, $folder_out) { - if ( !is_dir($folder_out) ) { - if ( !$this->CreatePath($folder_out) ) { + if (!is_dir($folder_out)) { + if (!$this->CreatePath($folder_out)) { return false; } } // Simple copy for a file - if ( is_file($folder_in . '/' . $source_file) ) { - return copy($folder_in . '/' . $source_file, $folder_out . '/' . basename($source_file) ); + if (is_file($folder_in . '/' . $source_file)) { + return copy($folder_in . '/' . $source_file, $folder_out . '/' . basename($source_file)); } return false; } - public function getByName($name = null) { - global $xoops; - $lang = empty($name) ? $xoops->getConfig('language') : strtolower($name); + $xoops = Xoops::getInstance(); + $name = empty($name) ? $xoops->getConfig('language') : strtolower($name); - $file_config = XLANGUAGE_CONFIG_FILE; - if ( !file_exists($file_config) || !isset($this->cached_config)) { + $file_config = $xoops->registry->get('XLANGUAGE_CONFIG_FILE'); + if (!file_exists($file_config) || !isset($this->cached_config)) { $this->loadConfig(); } - if ( isset($this->cached_config[$name]) ) { + if (isset($this->cached_config[$name])) { return $this->cached_config[$name]; } return null; } - - public function getAllLanguage( $asobject = true ) + public function getAllLanguage($asobject = true) { $criteria = new CriteriaCompo(); - $criteria->setSort( 'xlanguage_weight' ); - $criteria->setOrder( 'asc' ); + $criteria->setSort('xlanguage_weight'); + $criteria->setOrder('asc'); return parent::getAll($criteria, null, $asobject, true); } public function renderlist() { - global $xoops; - $xoops->tpl->assign('theme', $xoops->getModuleConfig('theme', 'xlanguage') ); - $xoops->tpl->assign('languages', $this->getAllLanguage(false) ); + $xoops = Xoops::getInstance(); + $xoops->tpl->assign('theme', $xoops->getModuleConfig('theme', 'xlanguage')); + $xoops->tpl->assign('languages', $this->getAllLanguage(false)); return $xoops->tpl->fetch('admin:xlanguage|xlanguage_admin_list.html'); } -} -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/autoload.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/autoload.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/autoload.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -46,5 +46,4 @@ 'windows-1258' => 'windows-1258', 'windows-874' => 'windows-874' ), -); -?> \ No newline at end of file +); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/functions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/functions.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/functions.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -17,10 +16,17 @@ * @version $Id$ */ +/** + * @param string|array $value + * @param string $out_charset + * @param string $in_charset + * + * @return array|string + */ function xlanguage_convert_encoding($value, $out_charset, $in_charset) { - if ( is_array($value) ) { - foreach ( $value as $key => $val ) { + if (is_array($value)) { + foreach ($value as $key => $val) { $value[$key] = xlanguage_convert_encoding($val, $out_charset, $in_charset); } } else { @@ -29,18 +35,26 @@ return $value; } +/** + * @param string $value + * @param string $out_charset + * @param string $in_charset + * + * @return string + */ function xlanguage_convert_item($value, $out_charset, $in_charset) { - if ( strtolower($in_charset) == strtolower($out_charset) ) { + $xoops = Xoops::getInstance(); + if (strtolower($in_charset) == strtolower($out_charset)) { return $value; } - $xconv_handler = @xoops_getmodulehandler('xconv', 'xconv', true); - if ( is_object($xconv_handler) && $converted_value = @$xconv_handler->convert_encoding($value, $out_charset, $in_charset) ) { + $xconv_handler = $xoops->getModuleHandler('xconv', 'xconv', true); + if (is_object($xconv_handler) && $converted_value = @$xconv_handler->convert_encoding($value, $out_charset, $in_charset)) { return $converted_value; } - if ( XOOPS_USE_MULTIBYTES && function_exists('mb_convert_encoding') ) { + if (XOOPS_USE_MULTIBYTES && function_exists('mb_convert_encoding')) { $converted_value = @mb_convert_encoding($value, $out_charset, $in_charset); - } elseif ( function_exists('iconv') ) { + } elseif (function_exists('iconv')) { $converted_value = @iconv($in_charset, $out_charset, $value); } $value = empty($converted_value) ? $value : $converted_value; @@ -52,74 +66,84 @@ * Analyzes some PHP environment variables to find the most probable language * that should be used * - * @param string $ string to analyze - * @param integer $ type of the PHP environment variable which value is $str - * @global array the list of available translations - * @global string the retained translation keyword - * @access private + * @param string $str string to analyze + * @param integer $envType type of the PHP environment variable which value is $str + * + * @return int|string */ -function xlanguage_lang_detect($str = '', $envType = '') +function xlanguage_lang_detect($str = '', $envType = 0) { - foreach ( $GLOBALS['available_languages'] AS $key => $value ) { + $xoops = Xoops::getInstance(); + $lang = 'en'; + foreach ($xoops->registry->get('XLANGUAGE_AVAILABLE_LANGUAGES') as $key => $value) { // $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable, // 2 for the 'HTTP_USER_AGENT' one $expr = $value[0]; - if ( strpos($expr, '[-_]') === FALSE ) { + if (strpos($expr, '[-_]') === FALSE) { $expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr); } - if ( ($envType == 1 && preg_match('^(' . $expr . ')(;q=[0-9]\\.[0-9])?$^', $str) ) || ($envType == 2 && preg_match('(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))', $str))) { - $lang = $key; - //if ( $lang != 'en' ) + if (($envType == 1 && preg_match('^(' . $expr . ')(;q=[0-9]\\.[0-9])?$^', $str)) || ($envType == 2 && preg_match('(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))', $str))) { + $lang = $key; break; } } return $lang; } +/** + * @return string + */ function xlanguage_detectLang() { - global $available_languages,$_SERVER; + $xoops = Xoops::getInstance(); - if ( !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) { + if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE']; } - if ( !empty($_SERVER['HTTP_USER_AGENT']) ) { + if (!empty($_SERVER['HTTP_USER_AGENT'])) { $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; } $lang = ''; - $xoops_lang =''; + $xoops_lang = ''; // 1. try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE // variable - if ( empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE) ) { + if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) { $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE); $acceptedCnt = count($accepted); reset($accepted); for ($i = 0; $i < $acceptedCnt; $i++) { $lang = xlanguage_lang_detect($accepted[$i], 1); - if ( strncasecmp($lang,'en',2) ) { + if (strncasecmp($lang, 'en', 2)) { break; } } } // 2. try to findout user's language by checking its HTTP_USER_AGENT variable - if ( empty($lang) && !empty($HTTP_USER_AGENT) ) { + if (empty($lang) && !empty($HTTP_USER_AGENT)) { $lang = xlanguage_lang_detect($HTTP_USER_AGENT, 2); } // 3. If we catch a valid language, configure it - if ( !empty($lang) ) { - $xoops_lang = $available_languages[$lang][1]; + if (!empty($lang)) { + $available = $xoops->registry->get('XLANGUAGE_AVAILABLE_LANGUAGES'); + $xoops_lang = $available[$lang][1]; } return $xoops_lang; } +/** + * @param string $output + * + * @return array|mixed|string + */ function xlanguage_encoding($output) { - global $xlanguage; + $xoops = Xoops::getInstance(); + $xlanguage = $xoops->registry->get('XLANGUAGE'); $output = xlanguage_ml($output); // escape XML doc - if ( preg_match("/^\<\?[\s]?xml[\s]+version=([\"'])[^\>]+\\1[\s]+encoding=([\"'])[^\>]+\\2[\s]?\?\>/i", $output) ) { + if (preg_match("/^\<\?[\s]?xml[\s]+version=([\"'])[^\>]+\\1[\s]+encoding=([\"'])[^\>]+\\2[\s]?\?\>/i", $output)) { return $output; } $in_charset = $xlanguage['charset_base']; @@ -128,22 +152,32 @@ return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset); } +/** + * @param string $s + * + * @return mixed + */ function xlanguage_ml($s) { - global $xoops, $xlanguage_langs; - if ( !is_object($xoops) ) { - $xoops = Xoops::getInstance(); + static $xlanguage_langs; + + $xoops = Xoops::getInstance(); + $xlanguage_handler = $xoops->registry->get('XLANGUAGE_HANDLER'); + + if (!is_object($xoops)) { + $xoops = Xoops::getInstance(); } $xoopsConfigLanguage = $xoops->getConfig('language'); - if ( !isset($xlanguage_langs) ) { - $langs = $GLOBALS['xlanguage_handler']->cached_config; - foreach ( array_keys($langs) as $_lang ) { + if (!isset($xlanguage_langs)) { + $langs = $xlanguage_handler->cached_config; + foreach (array_keys($langs) as $_lang) { $xlanguage_langs[$_lang] = $langs[$_lang]['xlanguage_code']; } unset($langs); } - if ( empty($xlanguage_langs) || count($xlanguage_langs) ==0) { + $xoops->registry->set('XLANGUAGE_LANGS', $xlanguage_langs); + if (empty($xlanguage_langs) || count($xlanguage_langs) == 0) { return $s; } @@ -156,70 +190,75 @@ // escape brackets inside of <textarea></textarea> $patterns[] = "/(\<textarea\b[^>]*>[^\<]*\<\/textarea>)/isU"; - $s = preg_replace_callback( $patterns , 'xlanguage_ml_escape_bracket' , $s ) ; + $s = preg_replace_callback($patterns, 'xlanguage_ml_escape_bracket', $s); // create the pattern between language tags - $pqhtmltags = explode( ',' , preg_quote( XLANGUAGE_TAGS_RESERVED , '/' ) ) ; - $mid_pattern = '(?:(?!(' . implode( '|' , $pqhtmltags ) . ')).)*' ; + $pqhtmltags = explode(',', preg_quote($xoops->registry->get('XLANGUAGE_TAGS_RESERVED'), '/')); + $mid_pattern = '(?:(?!(' . implode('|', $pqhtmltags) . ')).)*'; $patterns = array(); $replaces = array(); /* */ - if ( isset($xlanguage_langs[$xoopsConfigLanguage]) ) { + if (isset($xlanguage_langs[$xoopsConfigLanguage])) { $lang = $xlanguage_langs[$xoopsConfigLanguage]; $patterns[] = '/(\[([^\]]*\|)?' . preg_quote($lang) . '(\|[^\]]*)?\])(' . $mid_pattern . ')(\[\/([^\]]*\|)?' . preg_quote($lang) . '(\|[^\]]*)?\])/isU'; $replaces[] = '$4'; } /* */ - foreach ( array_keys($xlanguage_langs) as $_lang ) { - if ( $_lang == $xoopsConfigLanguage ) { + foreach (array_keys($xlanguage_langs) as $_lang) { + if ($_lang == $xoopsConfigLanguage) { continue; } $name = $xlanguage_langs[$_lang]; $patterns[] = '/(\[([^\]]*\|)?' . preg_quote($name) . '(\|[^\]]*)?\])(' . $mid_pattern . ')(\[\/([^\]]*\|)?' . preg_quote($name) . '(\|[^\]]*)?(\]\<br[\s]?[\/]?\>|\]))/isU'; $replaces[] = ''; } - if ( !empty($xoopsConfigLanguage) ) { - $s = preg_replace( '/\[[\/]?[\|]?' . preg_quote($xoopsConfigLanguage) . '[\|]?\](\<br \/\>)?/i' , '' , $s ) ; + if (!empty($xoopsConfigLanguage)) { + $s = preg_replace('/\[[\/]?[\|]?' . preg_quote($xoopsConfigLanguage) . '[\|]?\](\<br \/\>)?/i', '', $s); } - if ( count($replaces)>0 ) { - $s = preg_replace( $patterns , $replaces , $s ) ; + if (count($replaces) > 0) { + $s = preg_replace($patterns, $replaces, $s); } - return $s ; + return $s; } -function xlanguage_ml_escape_bracket( $matches ) +/** + * @param array $matches + * + * @return mixed + */ +function xlanguage_ml_escape_bracket($matches) { - global $xlanguage_langs; + $xoops = Xoops::getInstance(); + $xlanguage_langs = $xoops->registry->get('XLANGUAGE_LANGS'); + $ret = $matches[1]; - if ( !empty($xlanguage_langs) ) { - $pattern = '/(\[([\/])?(' . implode('|',array_map('preg_quote', array_values($xlanguage_langs))) . ')([\|\]]))/isU'; + if (!empty($xlanguage_langs)) { + $pattern = '/(\[([\/])?(' . implode('|', array_map('preg_quote', array_values($xlanguage_langs))) . ')([\|\]]))/isU'; $ret = preg_replace($pattern, '[\\2\\3\\4', $ret); } return $ret; } - function xlanguage_select_show($options = null) { - global $xoops; - if ( !constant(XLANGUAGE_THEME_ENABLE) ) { + $xoops = Xoops::getInstance(); + if (!$xoops->registry->get('XLANGUAGE_THEME_ENABLE')) { + define('XLANGUAGE_SWITCH_CODE', false); return false; } - include_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php'; - if ( empty($options) ) { - $options[0] = 'images'; // display style: image, text, select - $options[1] = ' '; // delimitor - $options[2] = 5; // items per line + if (empty($options)) { + $options[0] = 'images'; // display style: image, text, select + $options[1] = ' '; // delimitor + $options[2] = 5; // items per line } $block = b_xlanguage_select_show($options); $xoops->theme->addStylesheet('modules/xlanguage/css/block.css'); - $xoops->tpl->assign('block', $block ); + $xoops->tpl->assign('block', $block); $xlanguage_switch_code = "<div id='xo-language' class='" . $options[0] . "'>" . $xoops->tpl->fetch('db:xlanguage_block.html') . "</div>"; - define('XLANGUAGE_SWITCH_CODE', $xlanguage_switch_code); + define('XLANGUAGE_SWITCH_CODE',$xlanguage_switch_code); return true; -} -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/vars.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/vars.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/include/vars.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -17,34 +16,13 @@ * @version $Id$ */ -if ( !defined('XLANGUAGE_CONFIG_FILE') ) { - define('XLANGUAGE_CONFIG_FILE', 'xlanguage'); -} -if ( !defined('XLANGUAGE_LANG_TAG') ) { - define('XLANGUAGE_LANG_TAG', 'lang'); -} -if ( !defined('XLANGUAGE_TAGS_RESERVED') ) { - define('XLANGUAGE_TAGS_RESERVED', '</head>,</body>'); -} +$xoops = Xoops::getInstance(); +$xoops->registry->set('XLANGUAGE_CONFIG_FILE', 'xlanguage'); +$xoops->registry->set('XLANGUAGE_LANG_TAG', 'lang'); +$xoops->registry->set('XLANGUAGE_TAGS_RESERVED', '</head>,</body>'); +$xoops->registry->set('XLANGUAGE_THEME_ENABLE', true); +$xoops->registry->set('XLANGUAGE_THEME_OPTIONS', 'bootstrap| |5'); // display mode, delimitor, number per line -/* - * hardcoded scripts for language switching in theme html files - * - * To use it: - * 1 set '$xlanguage_theme_enable = true;' - * 2 config options "$options = array('images', ' ', 5); // display mode, delimitor, number per line"; Options for display mode: image - flag; text - text; dropdown - dropdown selection box with text - * 3 insert "<{$smarty.const.XLANGUAGE_SWITCH_CODE}>" into your theme html anywhere you would like to see it present - */ - -if ( !defined('XLANGUAGE_THEME_ENABLE') ) { - define('XLANGUAGE_THEME_ENABLE', 'true'); -} - -if ( !defined('XLANGUAGE_THEME_OPTIONS') ) { - define('XLANGUAGE_THEME_OPTIONS', 'bootstrap| |5' ); // display mode, delimitor, number per line -} - - /** * phpMyAdmin Language Loading File */ @@ -67,54 +45,33 @@ * without the '.php' extension. * 4. The last values associated to the key is the language code as defined by * the RFC1766. - * * Beware that the sorting order (first values associated to keys by * alphabetical reverse order in the array) is important: 'zh-tw' (chinese * traditional) must be detected before 'zh' (chinese simplified) for * example. - * * When there are more than one charset for a language, we put the -utf-8 * first. */ -$GLOBALS['available_languages'] = array( - 'ar' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic'), - 'bg' => array('bg|bulgarian', 'bulgarian'), - 'ca' => array('ca|catalan', 'catalan'), - 'cs' => array('cs|czech', 'czech'), - 'da' => array('da|danish', 'danish'), - 'de' => array('de([-_][[:alpha:]]{2})?|german', 'german'), - 'el' => array('el|greek', 'greek'), - 'en' => array('en([-_][[:alpha:]]{2})?|english', 'english'), - 'es' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish'), - 'et' => array('et|estonian', 'estonian'), - 'fi' => array('fi|finnish', 'finnish'), - 'fr' => array('fr([-_][[:alpha:]]{2})?|french', 'french'), - 'gl' => array('gl|galician', 'galician'), - 'he' => array('he|hebrew', 'hebrew'), - 'hr' => array('hr|croatian', 'croatian'), - 'hu' => array('hu|hungarian', 'hungarian'), - 'id' => array('id|indonesian', 'indonesian'), - 'it' => array('it|italian', 'italian'), - 'ja' => array('ja|japanese', 'japanese'), - 'ko' => array('ko|korean', 'koreano'), - 'ka' => array('ka|georgian', 'georgian'), - 'lt' => array('lt|lithuanian', 'lithuanian'), - 'lv' => array('lv|latvian', 'latvian'), - 'nl' => array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch'), - 'no' => array('no|norwegian', 'norwegian'), - 'pl' => array('pl|polish', 'polish'), - 'pt-br' => array('pt[-_]br|brazilian portuguese', 'portuguesebr'), - 'pt' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese'), - 'ro' => array('ro|romanian', 'romanian'), - 'ru' => array('ru|russian', 'russian'), - 'sk' => array('sk|slovak', 'slovak'), - 'sq' => array('sq|albanian', 'albanian'), - 'sr' => array('sr|serbian', 'serbian'), - 'sv' => array('sv|swedish', 'swedish'), - 'th' => array('th|thai', 'thai'), - 'tr' => array('tr|turkish', 'turkish'), - 'uk' => array('uk|ukrainian', 'ukrainian'), - 'zh-tw' => array('zh[-_]tw|chinese traditional', 'tchinese'), - 'zh-cn' => array('zh[-_]cn|chinese simplified', 'schinese'), - ); -?> \ No newline at end of file +$xoops->registry->set('XLANGUAGE_AVAILABLE_LANGUAGES', array( + 'ar' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic'), 'bg' => array('bg|bulgarian', 'bulgarian'), + 'ca' => array('ca|catalan', 'catalan'), 'cs' => array('cs|czech', 'czech'), + 'da' => array('da|danish', 'danish'), 'de' => array('de([-_][[:alpha:]]{2})?|german', 'german'), + 'el' => array('el|greek', 'greek'), 'en' => array('en([-_][[:alpha:]]{2})?|english', 'english'), + 'es' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish'), 'et' => array('et|estonian', 'estonian'), + 'fi' => array('fi|finnish', 'finnish'), 'fr' => array('fr([-_][[:alpha:]]{2})?|french', 'french'), + 'gl' => array('gl|galician', 'galician'), 'he' => array('he|hebrew', 'hebrew'), + 'hr' => array('hr|croatian', 'croatian'), 'hu' => array('hu|hungarian', 'hungarian'), + 'id' => array('id|indonesian', 'indonesian'), 'it' => array('it|italian', 'italian'), + 'ja' => array('ja|japanese', 'japanese'), 'ko' => array('ko|korean', 'koreano'), + 'ka' => array('ka|georgian', 'georgian'), 'lt' => array('lt|lithuanian', 'lithuanian'), + 'lv' => array('lv|latvian', 'latvian'), 'nl' => array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch'), + 'no' => array('no|norwegian', 'norwegian'), 'pl' => array('pl|polish', 'polish'), + 'pt-br' => array('pt[-_]br|brazilian portuguese', 'portuguesebr'), + 'pt' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese'), 'ro' => array('ro|romanian', 'romanian'), + 'ru' => array('ru|russian', 'russian'), 'sk' => array('sk|slovak', 'slovak'), + 'sq' => array('sq|albanian', 'albanian'), 'sr' => array('sr|serbian', 'serbian'), + 'sv' => array('sv|swedish', 'swedish'), 'th' => array('th|thai', 'thai'), + 'tr' => array('tr|turkish', 'turkish'), 'uk' => array('uk|ukrainian', 'ukrainian'), + 'zh-tw' => array('zh[-_]tw|chinese traditional', 'tchinese'), + 'zh-cn' => array('zh[-_]cn|chinese simplified', 'schinese'), + )); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php 2012-12-02 16:23:25 UTC (rev 10300) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php 2012-12-02 17:32:55 UTC (rev 10301) @@ -1,7 +1,6 @@ <?php /** * Xlanguage extension module - * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. @@ -19,7 +18,6 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); - /** * Xlanguage core preloads * @@ -28,29 +26,26 @@ * @author trabis <lus...@gm...> */ class XlanguageCorePreload extends XoopsPreloadItem -{ - static public function eventCoreLanguageCommon($args) - { - if (XlanguageCorePreload::isActive()) { - include_once dirname(dirname(__FILE__)) . '/api.php'; - } +{ + /** + * @param array $args + */ + static public function eventCoreHeaderStart($args) + { + include_once dirname(dirname(__FILE__)) . '/api.php'; + include_once dirname(dirname(__FILE__)) . '/include/vars.php'; + include_once dirname(dirname(__FILE__)) . '/include/functions.php'; } - static public function eventCoreHeaderCommon($args) - { + /** + * @param array $args + */ + static public function eventCoreHeaderEnd($args) + { + $xoops = Xoops::getInstance(); + include_once dirname(dirname(__FILE__)) . '/api.php'; include_once dirname(dirname(__FILE__)) . '/include/vars.php'; include_once dirname(dirname(__FILE__)) . '/include/functions.php'; - if (XlanguageCorePreload::isActive() && defined('XLANGUAGE_THEME_ENABLE') && constant('XLANGUAGE_THEME_ENABLE') ) { - xlanguage_select_show( explode('|', XLANGUAGE_THEME_OPTIONS) ); - } + xlanguage_select_show(explode('|', $xoops->registry->get('XLANGUAGE_THEME_OPTIONS'))); } - - static private function isActive() - { - global $xoops; - $module_handler = $xoops->getHandlerModule(); - $module = $module_handler->getByDirname('xlanguage'); - return ($module && $module->getVar('isactive')) ? true : false; - } -} -?> +} \ No newline at end of file |
From: <du...@us...> - 2013-01-07 16:42:33
|
Revision: 10694 http://sourceforge.net/p/xoops/svn/10694 Author: dugris Date: 2013-01-07 16:42:26 +0000 (Mon, 07 Jan 2013) Log Message: ----------- use Xoops_Module_Helper add php code and template for tinymce editor Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/moduladmin.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/admin/xlanguage_admin_list.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/xoops_version.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/helper.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/header.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -34,9 +34,9 @@ $xoops = Xoops::getInstance(); $system = System::getInstance(); +$helper = Xoops_Module_Helper::getHelper('xlanguage'); -$xlanguage_handler = $xoops->getModuleHandler('xlanguage', 'xlanguage'); -$xlanguage_handler->loadConfig(); +$helper->getHandlerLanguage()->loadConfig(); $xoops->header(); $xoops->theme()->addStylesheet('modules/xlanguage/css/moduladmin.css'); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/admin/index.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -18,31 +18,30 @@ include dirname(__FILE__) . '/header.php'; -$xoops = Xoops::getInstance(); switch ($op) { case 'save': if (!$xoops->security()->check()) { - $xoops->redirect('index.php', 5, implode(',', $xoops->security()->getErrors())); + $xoops->redirect('index.php', 2, implode(',', $xoops->security()->getErrors())); } $xlanguage_id = $system->CleanVars($_POST, 'xlanguage_id', 0, 'int'); if (isset($xlanguage_id) && $xlanguage_id > 0) { - $lang = $xlanguage_handler->get($xlanguage_id); + $lang = $helper->getHandlerLanguage()->get($xlanguage_id); } else { - $lang = $xlanguage_handler->create(); + $lang = $helper->getHandlerLanguage()->create(); } $lang->CleanVarsForDB(); - if ($xlanguage_handler->insert($lang)) { - $xlanguage_handler->createConfig(); - $xoops->redirect('index.php', 5, _AM_XLANGUAGE_SAVED); + if ($helper->getHandlerLanguage()->insert($lang)) { + $helper->getHandlerLanguage()->createConfig(); + $xoops->redirect('index.php', 2, _AM_XLANGUAGE_SAVED); } break; case 'add': - $lang = $xlanguage_handler->create(); - $form = $xoops->getModuleForm($lang, 'language', 'xlanguage'); + $lang = $helper->getHandlerLanguage()->create(); + $form = $helper->getForm($lang, 'language'); $admin_page->addInfoBox(_MI_XLANGUAGE_MODIFY); $admin_page->addInfoBoxLine($form->render()); break; @@ -50,30 +49,30 @@ case 'edit': $xlanguage_id = $system->CleanVars($_REQUEST, 'xlanguage_id', 0, 'int'); if (isset($xlanguage_id) && $xlanguage_id > 0) { - if ($lang = $xlanguage_handler->get($xlanguage_id)) { - $form = $xoops->getModuleForm($lang, 'language', 'xlanguage'); + if ($lang = $helper->getHandlerLanguage()->get($xlanguage_id)) { + $form = $helper->getForm($lang, 'language'); $admin_page->addInfoBox(_MI_XLANGUAGE_MODIFY); $admin_page->addInfoBoxLine($form->render()); } else { - $xoops->redirect('index.php', 5); + $xoops->redirect('index.php', 2); } } else { - $xoops->redirect('index.php', 5); + $xoops->redirect('index.php', 2); } break; case 'del': $xlanguage_id = $system->CleanVars($_REQUEST, 'xlanguage_id', 0, 'int'); if (isset($xlanguage_id) && $xlanguage_id > 0) { - if ($lang = $xlanguage_handler->get($xlanguage_id)) { + if ($lang = $helper->getHandlerLanguage()->get($xlanguage_id)) { $delete = $system->CleanVars($_POST, 'ok', 0, 'int'); if ($delete == 1) { if (!$xoops->security()->check()) { - $xoops->redirect('index.php', 5, implode(',', $xoops->security()->getErrors())); + $xoops->redirect('index.php', 2, implode(',', $xoops->security()->getErrors())); } - $xlanguage_handler->delete($lang); - $xlanguage_handler->createConfig(); - $xoops->redirect('index.php', 5, _AM_XLANGUAGE_DELETED); + $helper->getHandlerLanguage()->delete($lang); + $helper->getHandlerLanguage()->createConfig(); + $xoops->redirect('index.php', 2, _AM_XLANGUAGE_DELETED); } else { ob_start(); $xoops->confirm(array( @@ -85,22 +84,22 @@ $admin_page->addInfoBoxLine($confirm); } } else { - $xoops->redirect('index.php', 5); + $xoops->redirect('index.php', 2); } } else { - $xoops->redirect('index.php', 5); + $xoops->redirect('index.php', 2); } break; case 'createconfig': - $xlanguage_handler->createConfig(); - $xoops->redirect('index.php', 5, _AM_XLANGUAGE_CREATED); + $helper->getHandlerLanguage()->createConfig(); + $xoops->redirect('index.php', 2, _AM_XLANGUAGE_CREATED); break; case 'default': default: $admin_page->addInfoBox(_AM_XLANGUAGE_LANGLIST); - $admin_page->addInfoBoxLine($xlanguage_handler->renderlist()); + $admin_page->addInfoBoxLine($helper->getHandlerLanguage()->renderlist()); break; } include dirname(__FILE__) . '/footer.php'; Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/api.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -17,10 +17,16 @@ */ $xoops = Xoops::getInstance(); +$helper = Xoops_Module_Helper::getHelper('xlanguage'); + $xlanguage = array(); -include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php'; -include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php'; +if (XoopsLoad::fileExists($hnd_file = XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php')) { + include_once $hnd_file; +} +if (XoopsLoad::fileExists($hnd_file = XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php')) { + include_once $hnd_file; +} $cookie_var = $xoops->registry()->get('XLANGUAGE_LANG_TAG'); @@ -34,15 +40,14 @@ } elseif ($lang = xlanguage_detectLang()) { $xlanguage['lang'] = $lang; } else { - $xlanguage['lang'] = $xoops->getConfig('language'); + $xlanguage['lang'] = $helper->getConfig('language'); } -$xlanguage_handler = $xoops->getModuleHandler('xlanguage', 'xlanguage'); -$xlanguage_handler->loadConfig(); +$helper->getHandlerLanguage()->loadConfig(); -$lang = $xlanguage_handler->getByName($xlanguage['lang']); +$lang = $helper->getHandlerLanguage()->getByName($xlanguage['lang']); -if (is_array($lang) && strcasecmp($lang['xlanguage_name'], $xoops->getConfig('language'))) { +if (is_array($lang) && strcasecmp($lang['xlanguage_name'], $helper->getConfig('language'))) { $xoops->setConfig('language', $lang['xlanguage_name']); if ($lang['xlanguage_charset']) { $xlanguage['charset'] = $lang['xlanguage_charset']; @@ -53,7 +58,7 @@ } unset($lang); -$xoops->registry()->set('XLANGUAGE_HANDLER', $xlanguage_handler); +$xoops->registry()->set('XLANGUAGE_HANDLER', $helper->getHandlerLanguage()); if ($xlanguage['action']) { //if(CONV_REQUEST && (!empty($_GET)||!empty($_POST))){ Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/blocks/xlanguage_blocks.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -19,16 +19,17 @@ function b_xlanguage_select_show($options) { $xoops = Xoops::getInstance(); + $helper = Xoops_Module_Helper::getHelper('xlanguage'); + $xlanguage = $xoops->registry()->get('XLANGUAGE'); $lang_tag = $xoops->registry()->get('XLANGUAGE_LANG_TAG'); - $options[3] = $xoops->getModuleConfig('theme', 'xlanguage'); + $options[3] = $helper->getConfig('theme'); $block = array(); - $xlanguage_handler = $xoops->getModuleHandler('xlanguage', 'xlanguage'); - $xlanguage_handler->loadConfig(); + $helper->getHandlerLanguage()->loadConfig(); - if (!is_array($xlanguage_handler->cached_config) || count($xlanguage_handler->cached_config) < 1) { + if (!is_array($helper->getHandlerLanguage()->cached_config) || count($helper->getHandlerLanguage()->cached_config) < 1) { return $block; } @@ -60,7 +61,7 @@ $query_string .= empty($query_string) ? '' : '&'; } $block['url'] = $xoops->getEnv('PHP_SELF') . '?' . $query_string . $lang_tag . '='; - $block['languages'] = $xlanguage_handler->cached_config; + $block['languages'] = $helper->getHandlerLanguage()->cached_config; return $block; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -51,26 +51,37 @@ // language image $image_option_tray = new XoopsFormElementTray(_AM_XLANGUAGE_IMAGE, ''); - $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/media/xoops/images/flags/' . $xoops->getModuleConfig('theme', 'xlanguage') . '/'); + $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/media/xoops/images/flags/' . Xoops_Module_Helper::getHelper('xlanguage')->getConfig('theme') . '/'); $image_select = new XoopsFormSelect('', 'xlanguage_image', $obj->getVar('xlanguage_image')); $image_select->addOptionArray($image_array); - $image_select->setExtra("onchange='showImgSelected(\"image\", \"xlanguage_image\", \"/media/xoops/images/flags/" . $xoops->getModuleConfig('theme', 'xlanguage') . "/\", \"\", \"" . XOOPS_URL . "\")'"); + $image_select->setExtra("onchange='showImgSelected(\"image\", \"xlanguage_image\", \"/media/xoops/images/flags/" . Xoops_Module_Helper::getHelper('xlanguage')->getConfig('theme') . "/\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray('', ' '); $image_tray->addElement($image_select); - $image_tray->addElement(new XoopsFormLabel('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . XOOPS_URL . "/media/xoops/images/flags/" . $xoops->getModuleConfig('theme', 'xlanguage') . "/" . $obj->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>")); + $image_tray->addElement(new XoopsFormLabel('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . XOOPS_URL . "/media/xoops/images/flags/" . Xoops_Module_Helper::getHelper('xlanguage')->getConfig('theme') . "/" . $obj->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>")); $image_option_tray->addElement($image_tray); $this->addElement($image_option_tray); $this->addElement(new XoopsFormHidden('xlanguage_id', $obj->getVar('xlanguage_id'))); + /** + * Buttons + */ $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormHidden('op', 'save')); - $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $button_tray->addElement(new XoopsFormButton('', 'reset', _RESET, 'reset')); - $cancel_send = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); - $cancel_send->setExtra("onclick='javascript:history.go(-1);'"); - $button_tray->addElement($cancel_send); + $button = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); + $button->setClass('btn btn-success'); + $button_tray->addElement($button); + + $button_2 = new XoopsFormButton('', 'reset', _RESET, 'reset'); + $button_2->setClass('btn btn-warning'); + $button_tray->addElement($button_2); + + $button_3 = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); + $button_3->setExtra("onclick='javascript:history.go(-1);'"); + $button_3->setClass('btn btn-danger'); + $button_tray->addElement($button_3); + $this->addElement($button_tray); } Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -0,0 +1,63 @@ +<?php +/** + * Xlanguage module + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package Xlanguage + * @since 2.6.0 + * @author Laurent JEN (Aka DuGris) + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class XlanguageTinymceForm extends XoopsSimpleForm +{ + /** + * @param null $obj + */ + public function __construct($xlanguage) + { + $xoops = Xoops::getInstance(); + + parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal'); + + $lang_tray = new XoopsFormSelect(_XLANGUAGE_TINYMCE_SUBTITLE, 'mlanguages'); + $lang_tray->addOption('', _XLANGUAGE_TINYMCE_SELECT); + foreach($xlanguage as $k => $v) { + $lang_tray->addOption($v['xlanguage_code'], $v['xlanguage_description']); + } + $this->addElement($lang_tray, true); + + $text_tray = new XoopsFormTextArea('', 'mltext', '', 7, 7); + $text_tray->setExtra('onkeyup="XlanguageDialog.onkeyupMLC(this);"'); + $this->addElement($text_tray); + + $this->addElement(new XoopsFormRaw('<div id="mltext_msg"><script type="text/javascript">XoopsmlcontentDialog.onkeyupMLC(this);</script></div>')); + + /** + * Buttons + */ + $button_tray = new XoopsFormElementTray('', ''); + + $button = new XoopsFormButton('', 'submit', _SUBMIT, 'insert'); + $button->setExtra('onclick="XlanguageDialog.insertMLC();return false;"'); + $button->setClass('btn btn-success'); + $button_tray->addElement($button); + + $button_2 = new XoopsFormButton('', 'button', _CLOSE, 'button'); + $button_2->setExtra('onclick="tinyMCEPopup.close();"'); + $button_2->setClass('btn btn-warning'); + $button_tray->addElement($button_2); + + $this->addElement($button_tray); + } + +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/helper.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/helper.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/helper.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -0,0 +1,57 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package xlanguage + * @since 2.6.0 + * @author Laurent JEN (Aka DuGris) + * @version $Id$ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class Xlanguage extends Xoops_Module_Helper_Abstract +{ + /** + * Init the module + * + * @return null|void + */ + public function init() + { + if (XoopsLoad::fileExists($hnd_file = XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php')) { + include_once $hnd_file; + } + + if (XoopsLoad::fileExists($hnd_file = XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php')) { + include_once $hnd_file; + } + $this->setDirname('xlanguage'); + } + + /** + * @return Xlanguage + */ + static function getInstance() + { + return parent::getInstance(); + } + + /** + * @return XlanguageXlanguageHandler + */ + public function getHandlerLanguage() + { + return $this->getHandler('xlanguage'); + } +} \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/helper.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -20,7 +20,7 @@ include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php'; -class Xlanguage extends XoopsObject +class XlanguageLanguage extends XoopsObject { public function __construct() { @@ -35,9 +35,8 @@ public function getValues($keys = null, $format = 's', $maxDepth = 1) { - $xoops = Xoops::getInstance(); $ret = parent::getValues(); - $ret['xlanguage_image'] = XOOPS_URL . '/media/xoops/images/flags/' . $xoops->getModuleConfig('theme', 'xlanguage') . '/' . $this->getVar('xlanguage_image'); + $ret['xlanguage_image'] = XOOPS_URL . '/media/xoops/images/flags/' . Xoops_Module_Helper::getHelper('xlanguage')->getConfig('theme') . '/' . $this->getVar('xlanguage_image'); return $ret; } @@ -68,7 +67,7 @@ { public function __construct($db) { - parent::__construct($db, 'xlanguage', 'Xlanguage', 'xlanguage_id', 'xlanguage_name'); + parent::__construct($db, 'xlanguage', 'XlanguageLanguage', 'xlanguage_id', 'xlanguage_name'); } public function loadConfig() @@ -77,7 +76,7 @@ $this->configPath = XOOPS_VAR_PATH . '/configs/xlanguage/'; $this->configFile = $xoops->registry()->get('XLANGUAGE_CONFIG_FILE'); $this->configFileExt = '.php'; - $this->cached_config = $this->loadFileConfig(); + return $this->cached_config = $this->loadFileConfig(); } public function loadFileConfig() @@ -184,7 +183,7 @@ public function renderlist() { $xoops = Xoops::getInstance(); - $xoops->tpl()->assign('theme', $xoops->getModuleConfig('theme', 'xlanguage')); + $xoops->tpl()->assign('theme', Xoops_Module_Helper::getHelper('xlanguage')->getConfig('theme')); $xoops->tpl()->assign('languages', $this->getAllLanguage(false)); return $xoops->tpl()->fetch('admin:xlanguage|xlanguage_admin_list.html'); } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/moduladmin.css =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/moduladmin.css 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/css/moduladmin.css 2013-01-07 16:42:26 UTC (rev 10694) @@ -16,4 +16,7 @@ img.flag { width:24px; +} +.xo-window-data { + width: 100%; } \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -0,0 +1,22 @@ +<?php +/** + * Xlanguage extension module + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package xlanguage + * @since 2.6.0 + * @author Laurent JEN (Aka DuGris) + * @version $Id$ + */ + +define("_XLANGUAGE_TINYMCE_SUBTITLE", "Select a language and type/paste the content in the box below:"); +define("_XLANGUAGE_TINYMCE_SELECT", "Select language"); +?> \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/preloads/core.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -32,9 +32,9 @@ */ static public function eventCoreHeaderStart($args) { - include_once dirname(dirname(__FILE__)) . '/api.php'; - include_once dirname(dirname(__FILE__)) . '/include/vars.php'; - include_once dirname(dirname(__FILE__)) . '/include/functions.php'; + if (XoopsLoad::fileExists($hnd_file = dirname(dirname(__FILE__)) . '/api.php')) { + include_once $hnd_file; + } } /** Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/admin/xlanguage_admin_list.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/admin/xlanguage_admin_list.html 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/admin/xlanguage_admin_list.html 2013-01-07 16:42:26 UTC (rev 10694) @@ -1,11 +1,8 @@ -<style> - -</style> - -<table class="outer"> +<table class="outer width400"> <thead> <tr> <th class="txtcenter"><{$smarty.const._AM_XLANGUAGE_NAME}></th> + <th class="txtcenter"><{$smarty.const._AM_XLANGUAGE_DESCRIPTION}></th> <th class="txtcenter"><{$smarty.const._AM_XLANGUAGE_CHARSET}></th> <th class="txtcenter"><{$smarty.const._AM_XLANGUAGE_CODE}></th> <th class="txtcenter"><{$smarty.const._AM_XLANGUAGE_IMAGE}></th> @@ -18,6 +15,7 @@ <{foreachq from=$languages item=language key=key}> <tr class="<{cycle values="even,odd"}>"> <td class="txtcenter"><{$language.xlanguage_name}></td> + <td class="txtcenter"><{$language.xlanguage_description}></td> <td class="txtcenter"><{$language.xlanguage_charset}></td> <td class="txtcenter"><{$language.xlanguage_code}></td> <td class="txtcenter"><img class="flag" src="<{$language.xlanguage_image}>" /></td> Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html 2013-01-07 16:42:26 UTC (rev 10694) @@ -0,0 +1,21 @@ + <script type="text/javascript" src="../../tiny_mce_popup.js"></script> + <script type="text/javascript" src="../../utils/mctabs.js"></script> + <script type="text/javascript" src="../../utils/form_utils.js"></script> + <script type="text/javascript" src="../../utils/validate.js"></script> + <script type="text/javascript" src="js/xlanguage.js"></script> + + <link href="css/xlanguage.css" rel="stylesheet" type="text/css" /> + <base target="_self" /> +</head> +<body> + + <div class="tabs"> + <ul> + <li id="tab_mlcontent" class="current"><span><a href="javascript:mcTabs.displayTab('tab_mlcontent','mlcontent_panel');" onmousedown="return false;">{#xlanguage_dlg.title}</a></span></li> + </ul> + </div> + <br /> + <{$form}> + +</body> +</html> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/xoops_version.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/xoops_version.php 2013-01-07 12:29:41 UTC (rev 10693) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/xoops_version.php 2013-01-07 16:42:26 UTC (rev 10694) @@ -20,8 +20,8 @@ $modversion['name'] = _MI_XLANGUAGE_NAME; $modversion['description'] = _MI_XLANGUAGE_DESC; $modversion['version'] = '4.00'; -$modversion['author'] = 'JEN Laurent'; -$modversion['nickname'] = 'DuGris'; +$modversion['author'] = 'Xoops Core Development Team'; +$modversion['nickname'] = 'Laurent JEN'; $modversion['credits'] = 'Adi Chiributa - web...@ar...; wjue - http://www.wjue.org; GIJOE - http://www.peak.ne.jp; D.J.(phppp) - http://www.xoopsforge.com; trabis - Xoops Module Developer'; $modversion['license'] = 'GNU GPL 2.0'; $modversion['license_url'] = 'www.gnu.org/licenses/gpl-2.0.html/'; |
From: <du...@us...> - 2013-01-07 20:56:44
|
Revision: 10696 http://sourceforge.net/p/xoops/svn/10696 Author: dugris Date: 2013-01-07 20:56:40 +0000 (Mon, 07 Jan 2013) Log Message: ----------- Fix for tinymce plugin Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php 2013-01-07 17:58:39 UTC (rev 10695) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php 2013-01-07 20:56:40 UTC (rev 10696) @@ -29,18 +29,18 @@ parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal'); - $lang_tray = new XoopsFormSelect(_XLANGUAGE_TINYMCE_SUBTITLE, 'mlanguages'); + $lang_tray = new XoopsFormSelect(_XLANGUAGE_TINYMCE_SUBTITLE, 'select_language'); $lang_tray->addOption('', _XLANGUAGE_TINYMCE_SELECT); foreach($xlanguage as $k => $v) { $lang_tray->addOption($v['xlanguage_code'], $v['xlanguage_description']); } $this->addElement($lang_tray, true); - $text_tray = new XoopsFormTextArea('', 'mltext', '', 7, 7); - $text_tray->setExtra('onkeyup="XlanguageDialog.onkeyupMLC(this);"'); + $text_tray = new XoopsFormTextArea('', 'text_language', '', 7, 7); + $text_tray->setExtra('onkeyup="Xoops_xlanguageDialog.onkeyupMLC(this);"'); $this->addElement($text_tray); - $this->addElement(new XoopsFormRaw('<div id="mltext_msg"><script type="text/javascript">XoopsmlcontentDialog.onkeyupMLC(this);</script></div>')); + $this->addElement(new XoopsFormRaw('<div id="text_language_msg"><script type="text/javascript">Xoops_xlanguageDialog.onkeyupMLC(this);</script></div>')); /** * Buttons @@ -48,7 +48,7 @@ $button_tray = new XoopsFormElementTray('', ''); $button = new XoopsFormButton('', 'submit', _SUBMIT, 'insert'); - $button->setExtra('onclick="XlanguageDialog.insertMLC();return false;"'); + $button->setExtra('onclick="Xoops_xlanguageDialog.insertMLC();return false;"'); $button->setClass('btn btn-success'); $button_tray->addElement($button); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html 2013-01-07 17:58:39 UTC (rev 10695) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html 2013-01-07 20:56:40 UTC (rev 10696) @@ -2,20 +2,19 @@ <script type="text/javascript" src="../../utils/mctabs.js"></script> <script type="text/javascript" src="../../utils/form_utils.js"></script> <script type="text/javascript" src="../../utils/validate.js"></script> - <script type="text/javascript" src="js/xlanguage.js"></script> + <script type="text/javascript" src="js/xoops_xlanguage.js"></script> - <link href="css/xlanguage.css" rel="stylesheet" type="text/css" /> + <link href="css/xoops_xlanguage.css" rel="stylesheet" type="text/css" /> <base target="_self" /> </head> <body> <div class="tabs"> <ul> - <li id="tab_mlcontent" class="current"><span><a href="javascript:mcTabs.displayTab('tab_mlcontent','mlcontent_panel');" onmousedown="return false;">{#xlanguage_dlg.title}</a></span></li> + <li id="tab_mlcontent" class="current"><span><a href="javascript:mcTabs.displayTab('tab_mlcontent','mlcontent_panel');" onmousedown="return false;">{#xoops_xlanguage_dlg.title}</a></span></li> </ul> </div> <br /> <{$form}> - </body> </html> \ No newline at end of file |
From: <du...@us...> - 2013-01-07 23:26:10
|
Revision: 10697 http://sourceforge.net/p/xoops/svn/10697 Author: dugris Date: 2013-01-07 23:26:06 +0000 (Mon, 07 Jan 2013) Log Message: ----------- Fix for tinymce plugin Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php 2013-01-07 20:56:40 UTC (rev 10696) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/language.php 2013-01-07 23:26:06 UTC (rev 10697) @@ -47,7 +47,7 @@ $this->addElement(new XoopsFormText(_AM_XLANGUAGE_CODE, 'xlanguage_code', 5, 10, $obj->getVar('xlanguage_code')), true); // language weight - $this->addElement(new XoopsFormText(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 5, 10, $obj->getVar('xlanguage_weight'))); + $this->addElement(new XoopsFormText(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 1, 4, $obj->getVar('xlanguage_weight'))); // language image $image_option_tray = new XoopsFormElementTray(_AM_XLANGUAGE_IMAGE, ''); @@ -77,11 +77,23 @@ $button_2->setClass('btn btn-warning'); $button_tray->addElement($button_2); - $button_3 = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); - $button_3->setExtra("onclick='javascript:history.go(-1);'"); - $button_3->setClass('btn btn-danger'); - $button_tray->addElement($button_3); + switch (basename($xoops->getEnv('PHP_SELF'), '.php')) { + case 'xoops_xlanguage': + $button_3 = new XoopsFormButton('', 'button', _CLOSE, 'button'); + $button_3->setExtra('onclick="tinyMCEPopup.close();"'); + $button_3->setClass('btn btn-danger'); + $button_tray->addElement($button_3); + break; + case 'index': + default: + $button_3 = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); + $button_3->setExtra("onclick='javascript:history.go(-1);'"); + $button_3->setClass('btn btn-danger'); + $button_tray->addElement($button_3); + break; + } + $this->addElement($button_tray); } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php 2013-01-07 20:56:40 UTC (rev 10696) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/form/tinymce.php 2013-01-07 23:26:06 UTC (rev 10697) @@ -54,7 +54,7 @@ $button_2 = new XoopsFormButton('', 'button', _CLOSE, 'button'); $button_2->setExtra('onclick="tinyMCEPopup.close();"'); - $button_2->setClass('btn btn-warning'); + $button_2->setClass('btn btn-danger'); $button_tray->addElement($button_2); $this->addElement($button_tray); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php 2013-01-07 20:56:40 UTC (rev 10696) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/class/xlanguage.php 2013-01-07 23:26:06 UTC (rev 10697) @@ -43,7 +43,7 @@ public function CleanVarsForDB() { $system = System::getInstance(); - foreach ($this->getValues() as $k => $v) { + foreach (parent::getValues() as $k => $v) { if ($k != 'dohtml') { if ($this->vars[$k]['data_type'] == XOBJ_DTYPE_STIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_MTIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_LTIME) { $value = $system->CleanVars($_POST[$k], 'date', date('Y-m-d'), 'date') + $system->CleanVars($_POST[$k], 'time', date('u'), 'int'); @@ -68,6 +68,7 @@ public function __construct($db) { parent::__construct($db, 'xlanguage', 'XlanguageLanguage', 'xlanguage_id', 'xlanguage_name'); + $this->loadConfig(); } public function loadConfig() Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php 2013-01-07 20:56:40 UTC (rev 10696) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/language/english/tinymce.php 2013-01-07 23:26:06 UTC (rev 10697) @@ -17,6 +17,8 @@ * @version $Id$ */ +define("_XLANGUAGE_TINYMCE_INS", "Insert multi-language content"); +define("_XLANGUAGE_TINYMCE_ADD", "Add language"); define("_XLANGUAGE_TINYMCE_SUBTITLE", "Select a language and type/paste the content in the box below:"); define("_XLANGUAGE_TINYMCE_SELECT", "Select language"); ?> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html 2013-01-07 20:56:40 UTC (rev 10696) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/xlanguage/templates/xlanguage_tinymce.html 2013-01-07 23:26:06 UTC (rev 10697) @@ -11,10 +11,23 @@ <div class="tabs"> <ul> - <li id="tab_mlcontent" class="current"><span><a href="javascript:mcTabs.displayTab('tab_mlcontent','mlcontent_panel');" onmousedown="return false;">{#xoops_xlanguage_dlg.title}</a></span></li> + <li id="tab_xlanguage_browser" class="current"><span><a href="javascript:mcTabs.displayTab('tab_xlanguage_browser','xlanguage_browser_panel');" onmousedown="return false;"><{$smarty.const._XLANGUAGE_TINYMCE_INS}></a></span></li> + <{if $form_add}> + <li id="tab_xlanguage_add" class="current"><span><a href="javascript:mcTabs.displayTab('tab_xlanguage_add','xlanguage_add_panel');" onmousedown="return false;"><{$smarty.const._XLANGUAGE_TINYMCE_ADD}></a></span></li> + <{/if}> </ul> </div> <br /> - <{$form}> + + <div class="panel_wrapper"> + <div id="xlanguage_browser_panel" class="panel current" style="overflow:none;"> + <{$form_txt}> + </div> + <{if $form_add}> + <div id="xlanguage_add_panel" class="panel" style="overflow:none;"> + <{$form_add}> + </div> + <{/if}> + </div> </body> </html> \ No newline at end of file |