Project

General

Profile

« Previous | Next » 

Revision 1939

Added by darkviper over 11 years ago

added module MultiLingual to basic packet

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
25 Jul-2013 Build 1939 M.v.d.Decken(DarkViper)
15
+ added module MultiLingual to basic packet
14 16
25 Jul-2013 Build 1938 M.v.d.Decken(DarkViper)
15 17
! update Twig template engine to version 1.13.1
16 18
25 Jul-2013 Build 1937 M.v.d.Decken(DarkViper)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1938');
54
if(!defined('REVISION')) define('REVISION', '1939');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/MultiLingual/htt/lang.htt
1
{#
2
/**
3
 *
4
 * @category        modules
5
 * @package         multilingial
6
 * @author          WebsiteBaker Project, Luisehahne
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id:  $
13
 * @filesource      $HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17
#}
18
 
19
<div id="langmenu">
20

  
21
<table style="background: transparent;">
22
    <tbody>
23
    <tr style="background: transparent;">
24
{% for file in lang.FILES %}
25
    <td style="width:{{ file.LANG_ICON_WIDTH }};vertical-align:middle;">
26
    <a class="{{ file.LANG_ICON_CLASS }}" href="{{ file.LANG_PAGE_URL }}" title="{{ file.TEXT_PAGE_TITLE }}">
27
    <span>
28
    	<img style="border: none;" src="{{ file.URL_ICON_FOLDER }}/{{ file.LANG_ICON }}.{{ file.LANG_ICON_EXT }}" title="{{ file.TEXT_PAGE_TITLE }}" alt="{{ file.TEXT_PAGE_TITLE }}" />
29
    </span>
30
    </a>
31
    </td>
32
{% endfor %}
33
    </tr>
34
    </tbody>
35
</table>
36
</div>
branches/2.8.x/wb/modules/MultiLingual/htt/index.php
1
<?php
2
// *** This file is generated by WebsiteBaker Ver.2.8.3
3
// *** Creation date: 2013-05-26T05:26:07+00:00
4
// *** Do not modify this file manually
5
// *** WB will rebuild this file from time to time!!
6
// *************************************************
7
	header('HTTP/1.1 301 Moved Permanently');
8
	header('Location: ../../../index.php');
9
// *************************************************
branches/2.8.x/wb/modules/MultiLingual/tpl/lang.tpl
1
{#
2
/**
3
 *
4
 * @category        modules
5
 * @package         MultiLingial
6
 * @author          WebsiteBaker Project, Luisehahne
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id:  $
13
 * @filesource      $HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17
#}
18
 
19
<div id="langmenu">
20
{% for file in lang.FILES %}
21
    <span style="width:{{ file.LANG_ICON_WIDTH }};vertical-align:middle;">
22
    <a class="{{ file.LANG_ICON_CLASS }}" href="{{ file.LANG_PAGE_URL }}" title="{{ file.TEXT_PAGE_TITLE }}">
23
    <span>
24
    	<img style="border: none;" src="{{ file.URL_ICON_FOLDER }}/{{ file.LANG_ICON }}.{{ file.LANG_ICON_EXT }}" title="{{ file.TEXT_PAGE_TITLE }}" alt="{{ file.TEXT_PAGE_TITLE }}" />
25
    </span>
26
    </a>
27
    </span>
28
{% endfor %}
29
</div>
branches/2.8.x/wb/modules/MultiLingual/tpl/index.php
1
<?php
2
// *** This file is generated by WebsiteBaker Ver.2.8.3
3
// *** Creation date: 2013-05-26T05:26:07+00:00
4
// *** Do not modify this file manually
5
// *** WB will rebuild this file from time to time!!
6
// *************************************************
7
	header('HTTP/1.1 301 Moved Permanently');
8
	header('Location: ../../../index.php');
9
// *************************************************
branches/2.8.x/wb/modules/MultiLingual/tpl/lang.html.twig
1
{#
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * lang.twig
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      1.6.8
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  xyz
34
 */
35
#}
36
<div id="langmenu">
37
{% for aTarget in aTargetList %}
38
 <a href="{{ aTarget.sUrl }}" {% if aTarget.bCurrent %}class="current" {% endif %}title="{{ aTarget.sTitle }}">
39
<span>
40
  <img src="{{ aTarget.sIconUrl }}/flags/{{ aTarget.FilePrefix }}.png" class="width: 32px; height: 32px" 
41
     title="{{ aTarget.sTitle }}" alt="{{ aTarget.sLongTitle }}" />
42
    </span>
43
 </a>
44
{% endfor %}
45
</div>
branches/2.8.x/wb/modules/MultiLingual/uninstall.php
1
<?php
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * uninstall.php
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      1.6.8
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  xyz
34
 */
35

  
36
/* -------------------------------------------------------- */
37
// Must include code to stop this file being accessed directly
38
if(!defined('WB_URL')) {
39
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
40
	throw new IllegalFileException();
41
}
42
/* -------------------------------------------------------- */
43

  
branches/2.8.x/wb/modules/MultiLingual/info.php
1
<?php
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * info.php
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      1.6.8
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  provides a flexible posibility for changeing to a translated page
34
 */
35

  
36
$module_directory = 'MultiLingual';
37
$module_name = 'MultiLingual Switcher 1.6.8';
38
$module_function = 'snippet';
39
$module_version = '1.6.8';
40
$module_status	= 'alpha';
41
$module_platform = '2.8.4';
42
$module_author = 'Luisehahne';
43
$module_license = 'GNU General Public License';
44
$module_requirements = 'min. PHP 5.2.2 and WB 2.8.4 or higher';
45
$module_description = 'This snippet switches between different languages';
branches/2.8.x/wb/modules/MultiLingual/default.ini
1
;<?php exit(); ?>
2
;###############################################################################
3
;###                                                                         ###
4
;###   configurable settings for MultiLanguage                               ###
5
;###                                                                         ###
6
;###############################################################################
7
;
8
[twig-loader-file]
9
; settings for Twig_Loader_Filesystem
10
templates_dir    = "/tpl"
11
default_template = "lang.html.twig"
12
;
13
[twig-environment]
14
; settings for the Twig_Environment
15
autoescape          = false
16
cache               = false
17
strict_variables    = false
18
debug               = true
19
auto_reload         = false
20
base_template_class = false
21
;
branches/2.8.x/wb/modules/MultiLingual/update_keys.php
1
<?php
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * update_keys.php
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      1.6.8
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  xyz
34
 */
35

  
36
// Create new admin object
37
if(!defined('WB_URL'))
38
{
39
    $config_file = realpath('../../config.php');
40
    if(file_exists($config_file) && !defined('WB_URL'))
41
    {
42
    	require($config_file);
43
    }
44
}
45

  
46
$mod_path = dirname(__FILE__);
47
//$mod_rel = str_replace($_SERVER['DOCUMENT_ROOT'],'',str_replace('\\', '/', $mod_path ));
48
$mod_name = basename($mod_path);
49

  
50
// Get page id
51
// Include WB admin wrapper script
52
// Tells script to update when this page was last updated
53
$update_when_modified = false; 
54
require(WB_PATH.'/modules/admin.php');
55
$temp_page_id =  intval( htmlentities($page_id ) );
56

  
57
$mLang = ModLanguage::getInstance();
58
$mLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
59

  
60
// check for page languages
61
$oPageLang = new m_MultiLingual_Lib();
62
$Result = $oPageLang->updateDefaultPagesCode(); 
63
if($database->is_error())
64
{
65
	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/settings.php?page_id='.$temp_page_id );
66
} else {
67
	$admin->print_success($mLang->MESSAGE_PAGES_UPDATE_SETTINGS, ADMIN_URL.'/pages/settings.php?page_id='.$temp_page_id );
68
}
branches/2.8.x/wb/modules/MultiLingual/frontend.css
1
.anchor { margin :3px auto; }
2
div#langmenu {
3
   display :block;
4
   float :right;
5
   margin : 1px auto;
6
   min-height : 25px;
7
   padding :2px;
8
   position : relative;
9
   text-align :center;
10
   width :100%;
11
}
12
div#langmenu img { border :0; }
13
div#langmenu a.default span img {
14
   filter :alpha(opacity=100);
15
   -moz-opacity :1.0;
16
   -khtml-opacity :1.0;
17
   opacity :1.0;
18
   vertical-align : baseline;
19
}
20
div#langmenu a:hover span img, 
21
div#langmenu a.current span img {
22
   background :transparent;
23
   filter :alpha(opacity=30);
24
   -khtml-opacity :0.3;
25
   -moz-opacity :.3;
26
   opacity :.3;
27
   vertical-align : baseline;
28
}
branches/2.8.x/wb/modules/MultiLingual/languages/NL.php
1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         multilingial
6
 * @author          WebsiteBaker Project, Luisehahne
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id:  $
13
 * @filesource		$HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17

  
18
// Set the language information
19
$language_code = 'NL';
20
$language_name = 'Nederlands';
21
$language_version = '2.8.4';
22
$language_platform = '2.8.x';
23
$language_author = 'Stefan Braunewell, Matthias Gallas';
24
$language_license = 'GNU General Public License';
25

  
26
$MENU['LANG_PAGES'] = 'Taal Pages';
27
$LANG['NL'] = 'Nederlands';
28
$MESSAGE['PAGES_UPDATE_SETTINGS'] = 'Tags zijn bijgewerkt ';
branches/2.8.x/wb/modules/MultiLingual/languages/EN.php
1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         multilingial
6
 * @author          WebsiteBaker Project, Luisehahne
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id:  $
13
 * @filesource		$HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17

  
18
// Set the language information
19
$language_code = 'EN';
20
$language_name = 'English';
21
$language_version = '2.8.4';
22
$language_platform = '2.8.x';
23
$language_author = 'Stefan Braunewell, Matthias Gallas';
24
$language_license = 'GNU General Public License';
25

  
26
$MENU['LANG_PAGES'] = 'Languagepages';
27
$LANG['EN'] = 'english';
28
$MESSAGE['PAGES_UPDATE_SETTINGS'] = 'Catchwords were updated';
branches/2.8.x/wb/modules/MultiLingual/languages/FR.php
1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         multilingial
6
 * @author          WebsiteBaker Project, Luisehahne
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id:  $
13
 * @filesource		$HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17

  
18
// Set the language information
19
$language_code = 'FR';
20
$language_name = 'Fran&ccedil;ais';
21
$language_version = '2.8';
22
$language_platform = '2.8.x';
23
$language_author = 'Stefan Braunewell, Matthias Gallas';
24
$language_license = 'GNU General Public License';
25

  
26
$MENU['LANG_PAGES'] = 'Pages linguistiques';
27
$LANG['FR'] = 'Fran&ccedil;ais';
28
$MESSAGE['PAGES_UPDATE_SETTINGS'] = 'Des balises ont &eacute;t&eacute; mis &agrave; jour';
branches/2.8.x/wb/modules/MultiLingual/languages/index.php
1
<?php
2
// *** This file is generated by WebsiteBaker Ver.2.8.3
3
// *** Creation date: 2013-05-26T05:26:07+00:00
4
// *** Do not modify this file manually
5
// *** WB will rebuild this file from time to time!!
6
// *************************************************
7
	header('HTTP/1.1 301 Moved Permanently');
8
	header('Location: ../../../index.php');
9
// *************************************************
branches/2.8.x/wb/modules/MultiLingual/languages/DE.php
1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         multilingial
6
 * @author          WebsiteBaker Project, Luisehahne
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id:  $
13
 * @filesource		$HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17

  
18
// Set the language information
19
$language_code = 'DE';
20
$language_name = 'Deutsch';
21
$language_version = '2.8.4';
22
$language_platform = '2.8.x';
23
$language_author = 'Stefan Braunewell, Matthias Gallas';
24
$language_license = 'GNU General Public License';
25

  
26
$MENU['LANG_PAGES'] = 'Sprachseiten';
27
$LANG['DE'] = 'deutsch';
28
$MESSAGE['PAGES_UPDATE_SETTINGS'] = 'Schlagwörter wurden aktualisiert';
29
$TEXT['PAGE_TITLE'] = 'Sprachseiten';
branches/2.8.x/wb/modules/MultiLingual/include.php
1
<?php
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * include.php
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      0.0.1
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  provides a flexible posibility for changeing to a translated page
34
 */
35

  
36
if(!function_exists('language_menu'))
37
{
38
	function language_menu()
39
	{
40
		global $wb;
41
		if ( $wb->page_id  < 1){ return false; }
42
		$oPageLang = new m_MultiLingual_Lib();
43
		$sRetVal = $oPageLang->getLangMenu();
44
		return $sRetVal;
45
	}
46
}
branches/2.8.x/wb/modules/MultiLingual/readme.txt
1
If you wish to modify the template, just open the file /modules/MultiLingual/tpl/lang.html.twig
2

  
3
##########################################################################
4

  
5
Simple usage:
6
<?php if(function_exists('language_menu')){ echo language_menu(); } ?>
7

  
8
##########################################################################
9

  
10
advanced usage:
11
<?php
12
$langFunction = '';
13
// check if multiligual module is installed, default is off,
14
if(function_exists('language_menu')){ $langFunction = language_menu(); }
15
$multilang_flag = intval(($langFunction)!='');
16
$aStart       = SM2_ROOT+$multilang_flag;
17
echo $langFunction;
18

  
19
?>
20
$aStart defines the start level from show_menu2
21

  
branches/2.8.x/wb/modules/MultiLingual/Lib.php
1
<?php
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * Lib.php
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      1.6.8
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  provides a flexible posibility for changeing to a translated page
34
 */
35

  
36
class m_MultiLingual_Lib {
37
/** @var object instance of the WbAdaptor object */
38
	protected $_oReg = null;
39
/** @var object instance of the application object */
40
	private $_oApp     = null;
41
/** @var object instance of the database object */
42
	private $_oDb      = null;
43

  
44
	private $_defaultPageId = 0;
45

  
46

  
47
/** @var array holds several values from the default.ini */	
48
	private $_config     = array();
49
/** @var array set several values for Twig_Environment */	
50
	private $_aTwigEnv = array();
51
/** @var array set several values for Twig_Loader */	
52
	private $_aTwigLoader = array();
53
/**
54
 * constructor used to import some application constants and objects
55
 */	
56
	public function __construct() 
57
	{
58
		// import global vars and objects
59
		$this->_wbAdaptor();
60
	}
61

  
62
	/**
63
	 * used to import some WB-constants and objects
64
	 */	
65
	private function _wbAdaptor()
66
	{
67
		if(!defined('ADMIN_REL')) { define('ADMIN_REL', WB_REL.'/'.ADMIN_DIRECTORY); }
68

  
69
		$this->_oApp   = (isset($GLOBALS['admin']) ? $GLOBALS['admin'] : $GLOBALS['wb']);
70
		$this->_oDb    = WbDatabase::getInstance();
71
		$this->_oReg = WbAdaptor::getInstance();
72

  
73
		$this->_config = parse_ini_file(dirname(__FILE__).'/default.ini',true);
74
		$this->_aTwigEnv = $this->_config['twig-environment'];
75
		$this->_aTwigLoader = $this->_config['twig-loader-file'];
76

  
77
	}
78

  
79
	/**
80
	 * methode to update a var/value-pair into table
81
	 * @param integer $iPageId which page shall be updated
82
	 * @param string $sTable the pages table
83
	 * @param integer $iEntry 
84
	 * @return bool
85
	 */ 
86
	private function _updatePageCode($iPageId, $sTable, $iNewPageCode = null)
87
	{
88
		// if new Pagecode is missing then set the own page ID
89
		$entry = ( !isset($iNewPageCode) ? $iPageId : $iNewPageCode);
90
		$sql = 'UPDATE `'.$this->_oReg->TablePrefix.$sTable.'` '
91
		     . 'SET `page_code`='.$entry.', '
92
		     .     '`modified_when` = '.time().' '
93
		     . 'WHERE `page_id` = '.$iPageId;
94
		return (bool)$this->_oDb->query($sql);
95
	}
96

  
97
	/**
98
	 * compose the needed SQL statement
99
	 * @param integer $sLangKey
100
	 * @return database object with given SQL statement
101
	 */			
102
	private function _getLangInUsedDbResult ( $sLangKey='' ) 
103
	{
104
		$sql = 'SELECT DISTINCT `language`,'
105
		     .                 '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,'
106
		     .                 '`visibility`,`viewing_groups`,`viewing_users`,`position`,`page_title` '
107
		     . 'FROM `'.$this->_oReg->TablePrefix.'pages` '
108
		     . 'WHERE `level`= \'0\' '
109
		     .   'AND `root_parent`=`page_id` '
110
		     .   'AND `visibility`!=\'none\' '
111
		     .   'AND `visibility`!=\'hidden\' '
112
		     .   ( ($sLangKey!='') ? ' AND `language` = \''.$sLangKey.'\'' : '')
113
		     .   'GROUP BY `language` '
114
		     .   'ORDER BY `position`';
115
		return $this->_oDb->query($sql);
116
	}
117

  
118
	/**
119
	* 
120
	* search for pages with given page code and create a DB result object
121
	* @param integer Pagecode to search for
122
	* @return object result object or null on error
123
	*/
124
	private function _getPageCodeDbResult( $iPageCode )
125
	{
126
		$sql = 'SELECT `language`,'
127
		     .        '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,'
128
		     .        '`visibility`,`viewing_groups`,`viewing_users`,`position`,`page_title` '
129
		     .  'FROM `'.$this->_oReg->TablePrefix.'pages`'
130
		     .  'WHERE `page_code` = '.$iPageCode.' '
131
		     .  'ORDER BY `position`';
132
		return $this->_oDb->query($sql);
133
	}
134

  
135
	/**
136
	 * compose the needed SQL statement
137
	 * @param integer $sLangKey
138
	 * @return database object with given SQL statementt
139
	 */
140
	private function _getLangAddonsDbResult ( $sLangKey='' ) 
141
	{
142
		$sql = 'SELECT `directory`,`name`  FROM `'.$this->_oReg->TablePrefix.'addons` '
143
		     . 'WHERE `type` = \'language\' '
144
		     . ( ($sLangKey!='') ? ' AND `directory` = \''.$langKey.'\' ' : '')
145
		     . 'ORDER BY `directory`';
146
		return $this->_oDb->query($sql);
147
	}
148

  
149
	/**
150
	 * 
151
	 * @param integer $parent
152
	 * @return database object with given SQL statement
153
	 */
154
	private function _getPageListDbResult ( $parent ) 
155
	{
156
	    $sql = 'SELECT `language`,'
157
		     .        '`page_id`,`page_title`,`menu_title`, `page_code`, `parent` '
158
		     . 'FROM `'.$this->_oReg->TablePrefix.'pages` '
159
		     . 'WHERE `parent` = '.$parent. ' '
160
		     . 'ORDER BY `position`';
161
		return $this->_oDb->query($sql);
162
	}
163

  
164
	private function _getPageCodeValues(  $iPageCode=0 )
165
	{
166
		$aRetval = array();
167
		if( ($oRes = $this->_getPageCodeDbResult($iPageCode)) )
168
		{
169
			while($page = $oRes->fetchRow(MYSQL_ASSOC))
170
			{
171
			if(!$this->_oApp->page_is_visible($page)) {continue;}
172
			$aRetval[$page['language']] = $page;
173
			}
174
		}
175
		return $aRetval;
176
	}
177

  
178
	private function _getPageList($parent, $this_page=0 )
179
	{
180
		static $entries = array();
181
		if( ($oLang = $this->_getPageListDbResult($parent)) )
182
		{
183
			while($value = $oLang->fetchRow(MYSQL_ASSOC))
184
			{
185
				if (( $value['page_id'] != $this_page ) )
186
				{
187
				$entries [$value['page_id']]['language'] = $value['language'];
188
				$entries [$value['page_id']]['menu_title'] = $value['menu_title'];
189
				$this->_getPageList($value['page_id'], $this_page );
190
				}
191
			}
192
		}
193
		return $entries;
194
	}
195

  
196

  
197

  
198
	private function _getAllowedLanguagesFromAddons($sLangKey='')
199
	{
200
		$aLangAddons = array();
201
		if( ($oLang = $this->_getLangAddonsDbResult($sLangKey)) )
202
		{
203
			while( $aLang = $oLang->fetchRow(MYSQL_ASSOC) )
204
			{
205
				$aLangAddons[$aLang['directory']] = $aLang['name'];
206
			}
207
		}
208
		return $aLangAddons;
209
	}
210

  
211
	/**
212
	 * 
213
	 * 
214
	 * @param 
215
	 * @return array of first visible language pages with defined fields
216
	 */
217
	private function _getLanguagesDetailsInUsed ( $sLangKey='' ) 
218
	{
219
		$aRetval = array();
220
		if( ($oRes = $this->_getLangInUsedDbResult($sLangKey)) ) 
221
		{
222
			while($page = $oRes->fetchRow(MYSQL_ASSOC))
223
			{
224
				if(!$this->_oApp->page_is_visible($page)) {continue;}
225
				$aRetval[$page['language']] = $page;
226
			}
227
		}
228
		return $aRetval;
229
	}
230
	
231
	/**
232
	* m_MultiLingual_Lib::getLangMenuData()
233
	* 
234
	* @param mixed $config
235
	* @param mixed $oApp
236
	* @return
237
	*/
238
	private function _getLangMenuData ( ) 
239
	{
240
		$data = array();
241
		$SetLanguageUrl = array();
242
		$SetLanguageIcons = array();
243
		$SetLanguageIcons = $this->_getLanguagesDetailsInUsed( );
244
		if(sizeof($SetLanguageIcons)>1) 
245
		{
246
			$pages = $this->_getPageCodeValues( $this->_oApp->page_code );
247
			$tmppage = array_intersect_key($pages,$SetLanguageIcons);
248
			$pages = array_merge($SetLanguageIcons,$tmppage);
249
			foreach ( $SetLanguageIcons AS $value) 
250
			{
251
				$data[] = array(
252
				      'sIconUrl' => rtrim($this->_oReg->AppRel,'/').str_replace(rtrim($this->_oReg->DocumentRoot,'/'),'',str_replace('\\','/',dirname(__FILE__))),
253
				      'bCurrent' => ( ($value['language'] == $this->_oReg->Language ) ? true : false),
254
				      'sUrl' => $this->_oReg->AppRel.$this->_oReg->PagesDir.trim($pages[$value['language']]['link'],'/').$this->_oReg->PageExtension,
255
				      'sTitle' => $pages[$value['language']]['page_title'],
256
				      'FilePrefix' => strtolower($pages[$value['language']]['language']),
257
				);
258
			}
259
		}
260
		return $data;
261
	}
262

  
263
	/**
264
	* m_MultiLingual_Lib::getLangMenu()
265
	* 
266
	* @param mixed $config
267
	* @param mixed $oApp
268
	* @return
269
	*/
270
	private function _getLangMenuTwig ( ) 
271
	{
272
		$loader = new Twig_Loader_Filesystem( dirname(__FILE__).$this->_aTwigLoader['templates_dir'] );
273
		$twig   = new Twig_Environment( $loader );
274
		$data['aTargetList']   = $this->_getLangMenuData( );
275
		return $twig->render($this->_aTwigLoader['default_template'], $data);
276
	}
277

  
278

  
279
	public function getLangMenu() 
280
	{
281
		return $this->_getLangMenuTwig ( );
282
	}
283

  
284
	public function updateDefaultPagesCode (  ) 
285
	{
286
		$retVal  = false;
287
		$aLangs  = $this->_getLanguagesDetailsInUsed(  );
288
		$entries = $this->_getPageList( 0 );
289
// fill page_code with page_id for default_language
290
		while( list( $page_id, $val ) = each ( $entries ) )
291
		{
292
			if( $val['language'] == $this->_oReg->DefaultLangauage ) {
293
				if( ($retVal = $this->_updatePageCode((int)$page_id, 'pages', (int)$page_id ))==false ){ break;  }
294
			}
295
		}
296
		return $retVal;
297
	}
298
	
299
}
branches/2.8.x/wb/modules/MultiLingual/flags/index.php
1
<?php
2
// *** This file is generated by WebsiteBaker Ver.2.8.3
3
// *** Creation date: 2013-05-26T05:26:07+00:00
4
// *** Do not modify this file manually
5
// *** WB will rebuild this file from time to time!!
6
// *************************************************
7
	header('HTTP/1.1 301 Moved Permanently');
8
	header('Location: ../../../index.php');
9
// *************************************************
branches/2.8.x/wb/modules/MultiLingual/install.php
1
<?php
2
/**
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

  
19
/**
20
 * install.php
21
 *
22
 * @category     Modules
23
 * @package      Modules_MultiLingual
24
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @author       Dietmar Wöllbrink <dietmar.woellbrink@websiteBaker.org>
26
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      1.6.8
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 09.01.2013
33
 * @description  xyz
34
 */
35

  
36
/* -------------------------------------------------------- */
37
// Must include code to stop this file being accessed directly
38
if(!defined('WB_URL')) {
39
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
40
	throw new IllegalFileException();
41
}
42
/* -------------------------------------------------------- */
branches/2.8.x/wb/modules/MultiLingual/index.php
1
<?php
2
// *** This file is generated by WebsiteBaker Ver.2.8.3
3
// *** Creation date: 2013-05-26T05:26:07+00:00
4
// *** Do not modify this file manually
5
// *** WB will rebuild this file from time to time!!
6
// *************************************************
7
	header('HTTP/1.1 301 Moved Permanently');
8
	header('Location: ../../index.php');
9
// *************************************************
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff