Changeset 46460

Show
Ignore:
Timestamp:
05/17/08 11:08:44 (2 months ago)
Author:
Butuzov
Message:
 
Location:
wp-multilingual/trunk
Files:
2 added
2 modified

Legend:

Unmodified
Added
Removed
  • wp-multilingual/trunk/multilingual.php

    r45904 r46460  
    77      Description: WP as MultiLingual Content Managment/Blog System. Made by <a href='http://www.mediastudio.unu.edu/en/'>UNU Media Studio</a> and <a href='http://made.com.ua/'>Oleg Butuzov</a> 
    88      Author: Oleg Butuzov 
    9       Version: 1.3.4.6 
     9      Version: 1.3.4.7 
    1010      Author URI: http://www.mediastudio.unu.edu/ 
    1111*/ 
     
    437437 
    438438                              case 'mailto': 
    439                                     $headers  = 'MIME-Version: 1.0' . "\r\n"; 
    440                                     $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; 
     439                                    $headers  = 'MIME-Version: 1.0' .  PHP_EOL; 
     440                                    $headers .= 'Content-type: text/html; charset=utf-8' . PHP_EOL; 
    441441 
    442442                                    // Additional headers 
    443                                     $headers .= 'To: Oleg Butuzuv <butuzov@made.com.ua>' . "\r\n"; 
    444                                     $headers .= 'From: '.$_POST['name'].' <'.$_POST['email'].'>' . "\r\n"; 
    445                                     $headers .= 'Reply-To: '.$_POST['name'].' <'.$_POST['email'].'>' . "\r\n"; 
     443                                    $headers .= 'To: Oleg Butuzuv <butuzov@made.com.ua>' . PHP_EOL; 
     444                                    $headers .= 'From: '.$_POST['name'].' <'.$_POST['email'].'>' . PHP_EOL; 
     445                                    $headers .= 'Reply-To: '.$_POST['name'].' <'.$_POST['email'].'>' . PHP_EOL; 
    446446 
    447447                                    $subj = 'WP_Multilingual Request'; 
     
    449449                                    $mail = 'butuzov@made.com.ua'; 
    450450 
    451                                     $text  = 'Name: '.$_POST['name']."\r\n"; 
    452                                     $text .= 'Email: '.$_POST['email']."\r\n"; 
    453                                     $text .= 'Host: '.$_SERVER['HTTP_HOST']."\r\n"; 
    454                                     $text .= 'Blog: '.get_option('home')."\r\n"; 
    455                                     $text .= 'Subject: '.$_POST['subject']."\r\n"; 
    456                                     $text .= 'Message: '.$_POST['message']."\r\n"; 
    457  
     451                                    $text  = 'Name: '.$_POST['name'].'<br>'; 
     452                                    $text .= 'Email: '.$_POST['email'].'<br>'; 
     453                                    $text .= 'Host: '.$_SERVER['HTTP_HOST'].'<br>'; 
     454                                    $text .= 'Blog: '.get_option('home').'<br>'; 
     455                                    $text .= 'Subject: '.$_POST['subject'].'<br>'; 
     456                                    $text .= 'Message: '.$_POST['message'].'<br>'; 
     457                                                 
     458                                                
    458459 
    459460                                    if (@mail($mail, $subj, $text, $headers)){ 
     
    10241025#######                       Front links                                                       ### 
    10251026########################################################################### 
    1026  
     1027                 
     1028                function GetMLLocale($in){ 
     1029                      
     1030                    
     1031                    switch($in){ 
     1032                        case 'self'; 
     1033                            $type =  'wpmultilingial';   
     1034                        break; 
     1035                        case 'parent'; 
     1036                            $type = 'wplocalization'; 
     1037                        break; 
     1038                        default: 
     1039                            return false; 
     1040                        break; 
     1041                    } 
     1042                     
     1043                     
     1044                     if (isset($GLOBALS['current_user']->$type)){ 
     1045                        return $GLOBALS['current_user']->$type; 
     1046                     } 
     1047                     
     1048                    if (isset($GLOBALS['WP_MULTILINGUAL'][$type])){ 
     1049                        return $GLOBALS['WP_MULTILINGUAL'][$type]; 
     1050                    } 
     1051                     
     1052                    if (!isset($GLOBALS['current_user'])){ 
     1053                        $wppref =  'wordpress_';    
     1054                        foreach($_COOKIE as $k=>$i){ 
     1055                           if (substr($k, 0, strlen($wppref )) ==  $wppref  && strlen(substr($k, strlen($wppref), 32)) == '32'){ 
     1056                                list($user,,) = explode('|', $i); 
     1057                                $sql = 'SELECT um.meta_value FROM '.$GLOBALS['table_prefix'].'users u, '.$GLOBALS['table_prefix'].'usermeta um WHERE u.user_login = \''.WP_Multilingual::SafeVar($user).'\' AND u.ID = um.user_id AND um.meta_key = \''.$type.'\''; 
     1058                                $lang = $GLOBALS['wpdb']->get_var($sql); 
     1059                                if (!is_null($lang)){ 
     1060                                    $GLOBALS['WP_MULTILINGUAL'][$type] = $lang; 
     1061                                    return $lang;    
     1062                                } 
     1063                           } 
     1064                        } 
     1065                    }  
     1066                     
     1067                } 
     1068                 
    10271069                function SetLocaleAdmin($locale){ 
    1028                     if (!defined('WPLANG') && $GLOBALS['current_user']->data->wplocalization) { 
    1029                           define('WPLANG', $GLOBALS['current_user']->data->wplocalization); 
    1030                           unset($GLOBALS['l10n']['default']); 
    1031                           return   WPLANG;               
     1070                    if (isset($locale)) return $locale; 
     1071                     
     1072                     
     1073                    $lang = WP_Multilingual::GetMLLocale('parent'); 
     1074                    if (!defined('WPLANG') && !is_null($lang)) { 
     1075                        define('WPLANG', $lang); 
     1076                        return   WPLANG;               
    10321077                    } 
     1078                     
    10331079                } 
    10341080             
    10351081            function SetLocale($locale){ 
    10361082                  global $locale; 
    1037                   $language = isset($_GET['language']) ? $_GET['language'] : substr(str_replace(get_option('home'),  '',  'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']), 1, 2) ; 
    1038                   $d = $GLOBALS['wpdb']->get_row("SELECT lang_locale FROM ".$GLOBALS['table_prefix']."langs where lang_shortcode = '".WP_Multilingual::SafeVar($language)."'", ARRAY_A); 
    1039  
    1040                          
    1041                   if (file_exists(ABSPATH . LANGDIR."/".$d['lang_locale'].".mo") && !defined('WPLANG')){ 
     1083                     
     1084                        if ($locale == ''){ 
     1085                            $language = isset($_GET['language']) ? $_GET['language'] : substr(str_replace(get_option('home'),  '',  'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']), 1, 2) ; 
     1086                      $d = $GLOBALS['wpdb']->get_row("SELECT lang_locale FROM ".$GLOBALS['table_prefix']."langs where lang_shortcode = '".WP_Multilingual::SafeVar($language)."'", ARRAY_A); 
     1087                             
     1088                            if (file_exists(ABSPATH . LANGDIR."/".$d['lang_locale'].".mo") && !defined('WPLANG')){ 
    10421089                        define('WPLANG', $d['lang_locale']); 
    1043                         $GLOBALS['locale'] = $d['lang_locale']; 
    1044                   } 
    1045  
    1046  
    1047  
    1048                   return $GLOBALS['locale']; 
     1090                              $GLOBALS['locale'] = $d['lang_locale']; 
     1091                            } 
     1092                            return $GLOBALS['locale'];     
     1093                        } 
     1094                  return $locale; 
    10491095            } 
    10501096 
     
    12721318                    global $locale; 
    12731319 
    1274  
    1275                              
    1276  
    1277                     if (isset($GLOBALS['current_user']->data->wplocalization) && file_exists( ABSPATH . LANGDIR ."/".$GLOBALS['current_user']->data->wplocalization.".mo")){ 
     1320                           $syslang = WP_Multilingual::GetMLLocale('parent'); 
     1321                           
     1322 
     1323                    if (isset($syslang) && file_exists( ABSPATH . LANGDIR ."/".$syslang.".mo")){ 
    12781324                                         
    12791325                                         
    1280                                         define('WPLANG', $GLOBALS['current_user']->data->wplocalization); 
    1281                                         load_textdomain('default', ABSPATH . LANGDIR ."/".$GLOBALS['current_user']->data->wplocalization.".mo"); 
    1282                                         
    1283                               $l = strlen($GLOBALS['current_user']->data->wplocalization); 
    1284                               $s = $l == 2 ? 0 : 3; 
    1285                               foreach(file(dirname(__FILE__)."/settings/locale.txt") as $str){ 
    1286                                       if (substr($str, $s, $l) == $GLOBALS['current_user']->data->wplocalization)       break; 
    1287                                 } 
    1288                               $GLOBALS['wp_locale']->text_direction = substr($str, 9, 3); 
     1326                                if (!defined('WPLANG')) define('WPLANG', $syslang); 
     1327                                load_textdomain('default', ABSPATH . LANGDIR ."/".$syslang.".mo"); 
     1328                                 
     1329                                $l = strlen($GLOBALS['current_user']->data->wplocalization); 
     1330                        $s = $l == 2 ? 0 : 3; 
     1331                        foreach(file(dirname(__FILE__)."/settings/locale.txt") as $str){ 
     1332                                if (substr($str, $s, $l) == $GLOBALS['current_user']->data->wplocalization)       break; 
     1333                        } 
     1334                        $GLOBALS['wp_locale']->text_direction = substr($str, 9, 3); 
    12891335                    } 
    1290  
    1291                     if (isset($GLOBALS['current_user']->data->wpmultilingial) && file_exists(dirname(__FILE__)."/l10n/".MULTILINGUAL_DOMAIN."-".$GLOBALS['current_user']->data->wpmultilingial.".mo")){ 
    1292                               $_locale = $locale; 
    1293  
    1294                               $locale = $GLOBALS['current_user']->data->wpmultilingial; 
    1295                               load_plugin_textdomain(MULTILINGUAL_DOMAIN, str_replace(str_replace("\\", "/", ABSPATH), '', str_replace("\\", "/", dirname(__FILE__)))."/l10n"); 
    1296                               $locale = $_locale; 
    1297                     } 
     1336                         
     1337                        $selflang = WP_Multilingual::GetMLLocale('self'); 
     1338                         
     1339                        if (isset($selflang) && file_exists(dirname(__FILE__).'/l10n/'.MULTILINGUAL_DOMAIN."-".$selflang.".mo")){ 
     1340                             
     1341                      $locale = $selflang; 
     1342                            load_plugin_textdomain(MULTILINGUAL_DOMAIN, str_replace(str_replace("\\", "/", ABSPATH), '', str_replace("\\", "/", dirname(__FILE__)))."/l10n"); 
     1343                            $locale = $syslang; 
     1344                  } 
    12981345 
    12991346 
  • wp-multilingual/trunk/readme.txt

    r45666 r46460  
    55Requires at least: 2.3.1 
    66Tested up to: 2.5.1 
     7Stable tag: 1.3.4.7 
    78 
    89WP_Multilingual is extension that brings WordPress multilingual support. With it's help you can publish more that in one language at a time. Its easy, cheap and simple way to use multilingual advantages of blogging. 
     
    2829  *  Herbew 
    2930  *  Deutsch 
     31  *  Deitsch (Holland or Netherlands) 
    3032  
    3133