Skip to content

Commit

Permalink
3.2.9.3 pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
johnclause committed Mar 27, 2015
1 parent dcb9d82 commit 9aa751a
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 53 deletions.
4 changes: 2 additions & 2 deletions admin/css/opLSBStyle/Simple_Buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
{
border: 1px solid #ccc;
background-image: linear-gradient(to top,#e5e5e5,#f4f4f4);
//margin-top: 2px;
//padding: 8px;
/* margin-top: 2px; */
/* padding: 8px; */
padding: 0 0 2px 4px;
margin: 0 4px 0 0;
cursor: default;
Expand Down
1 change: 0 additions & 1 deletion admin/css/opLSBStyle/Tabs_in_Block.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

.qtranxs-lang-switch-wrap
{
//margin: 10px 0;
margin: 0;
}

Expand Down
3 changes: 2 additions & 1 deletion admin/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,8 @@ var qTranslateX=function(pg)
return;
}

{
//create sets of LSB
if(qTranslateConfig.enabled_languages.length > 1){
var anchors=[];
if(qTranslateConfig.page_config && qTranslateConfig.page_config.anchors){
for(var i=0; i < qTranslateConfig.page_config.anchors.length; ++i){
Expand Down
2 changes: 1 addition & 1 deletion admin/js/common.min.js

Large diffs are not rendered by default.

39 changes: 29 additions & 10 deletions admin/qtx_activation_hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function qtranxf_default_enabled_languages()
{
//$locale = defined('WPLANG') ? WPLANG : get_option('WPLANG','en_US');
$locale = get_locale();
if(!$locale) $locale = 'en_US';
$lang = null;
$locales = qtranxf_default_locale();
foreach($locales as $ln => $lo){
Expand All @@ -42,6 +43,7 @@ function qtranxf_default_enabled_languages()
$langs['not_available'][$lang] = 'Sorry, this entry is only available in %LANG:, : and %.';
qtranxf_save_languages($langs);
}
//qtranxf_dbg_log('qtranxf_default_enabled_languages: $lang='.$lang.' $locale:',$locale);
return array($lang);
//return array( 'de', 'en', 'zh' );
}
Expand Down Expand Up @@ -118,17 +120,34 @@ function qtranxf_activation_hook()

function qtranxf_admin_notices_version()
{
$ver = get_option('qtranslate_version');
//qtranxf_dbg_log('qtranxf_admin_notices_version: ver:',$ver);
if($ver != QTX_VERSION){
update_option('qtranslate_version',QTX_VERSION);
$ver_prv = get_option('qtranslate_version');
$ver_cur = str_replace('.','',QTX_VERSION);
while(strlen($ver_cur) < 5) $ver_cur.='0';
$ver_cur = intval($ver_cur);
if($ver_cur != $ver_prv){
update_option('qtranslate_version',$ver_cur);
if($ver_prv === false){
$ver_prv = get_option('qtranslate_version_previous');
if($ver_prv===false){
update_option('qtranslate_version_previous', $ver_cur);
return;
}
}else{
update_option('qtranslate_version_previous', intval($ver_prv));
}
}else{
$ver_prv = get_option('qtranslate_version_previous');
}
switch(QTX_VERSION){
case '3.2.9.2':
case '3.3':
qtranxf_admin_notices_new_options(array('Highlight Style','LSB Style'),QTX_VERSION);
break;
default: break;
if(!$ver_prv) return;//first time installation
if($ver_cur == $ver_prv) return;//never updated
$ver_prv = get_option('qtranslate_version_previous');
if(!$ver_prv){
$firsttime = get_option('qtranslate_next_thanks') === false;
if($firsttime) return;
$ver_prv = 32920;
}
if($ver_prv >= 32920 && $ver_cur <= 33000){
qtranxf_admin_notices_new_options(array('Highlight Style','LSB Style'),QTX_VERSION);
}
}
add_action('admin_notices', 'qtranxf_admin_notices_version');
Expand Down
59 changes: 28 additions & 31 deletions admin/qtx_configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

function qtranxf_reset_config()
{
global $qtranslate_options;

if(!current_user_can('manage_options')) return;

$next_thanks = get_option('qtranslate_next_thanks');
Expand All @@ -37,6 +39,7 @@ function qtranxf_reset_config()
if( !isset($_POST['qtranslate_reset']) || !isset($_POST['qtranslate_reset2']) ) return;
// reset all settings
foreach($qtranslate_options['int'] as $nm => $def){ delete_option('qtranslate_'.$nm); }
foreach($qtranslate_options['bool'] as $nm => $def){ delete_option('qtranslate_'.$nm); }
foreach($qtranslate_options['str'] as $nm => $def){ delete_option('qtranslate_'.$nm); }
foreach($qtranslate_options['array'] as $nm => $def){ delete_option('qtranslate_'.$nm); }
foreach($qtranslate_options['default_value'] as $nm => $def){ delete_option('qtranslate_'.$nm); }
Expand All @@ -46,33 +49,16 @@ function qtranxf_reset_config()
delete_option('qtranslate_admin_notices');
delete_option('qtranslate_next_thanks');
delete_option('qtranslate_next_update_mo');
delete_option('qtranslate_widget_css'); // obsolete option
/*
delete_option('qtranslate_language_names');
delete_option('qtranslate_enabled_languages');
delete_option('qtranslate_default_language');
delete_option('qtranslate_flag_location');
delete_option('qtranslate_flags');
delete_option('qtranslate_locales');
delete_option('qtranslate_na_messages');
delete_option('qtranslate_date_formats');
delete_option('qtranslate_time_formats');
delete_option('qtranslate_ignore_file_types');
delete_option('qtranslate_detect_browser_language');
delete_option('qtranslate_hide_untranslated');
delete_option('qtranslate_show_displayed_language_prefix');
delete_option('qtranslate_auto_update_mo');
delete_option('qtranslate_hide_default_language');
delete_option('qtranslate_qtrans_compatibility');
delete_option('qtranslate_custom_fields');
delete_option('qtranslate_use_secure_cookie');
delete_option('qtranslate_disable_client_cookies');
delete_option('qtranslate_filter_options');
delete_option('qtranslate_header_css_on');
delete_option('qtranslate_header_css');
*/
delete_option('qtranslate_version');
// obsolete options
delete_option('qtranslate_widget_css');
delete_option('qtranslate_disable_header_css');
if(isset($_POST['qtranslate_reset3'])) {
delete_option('qtranslate_term_name');
if(isset($_POST['qtranslate_reset4'])){//not implemented yet
delete_option('qtranslate_version_previous');
//and delete translations in posts
}
}
qtranxf_reloadConfig();
}
Expand Down Expand Up @@ -115,8 +101,19 @@ function qtranxf_update_option( $nm, $default_value=null ) {
}

function qtranxf_update_option_bool( $nm, $default_value=null ) {
global $q_config;
if( !isset($q_config[$nm]) || ($default_value !== null && $default_value === $q_config[$nm]) ){
global $q_config, $qtranslate_options;
if( !isset($q_config[$nm]) ){
delete_option('qtranslate_'.$nm);
return;
}
if(is_null($default_value)){
if(isset($qtranslate_options['default_value'][$nm])){
$default_value = $qtranslate_options['default_value'][$nm];
}elseif(isset($qtranslate_options['bool'][$nm])){
$default_value = $qtranslate_options['bool'][$nm];
}
}
if( !is_null($default_value) && $default_value === $q_config[$nm] ){
delete_option('qtranslate_'.$nm);
}else{
update_option('qtranslate_'.$nm, $q_config[$nm]?'1':'0');
Expand All @@ -134,8 +131,8 @@ function qtranxf_saveConfig() {
qtranxf_update_option($nm,$def);
}

foreach($qtranslate_options['bool'] as $nm){
qtranxf_update_option_bool($nm);
foreach($qtranslate_options['bool'] as $nm => $def){
qtranxf_update_option_bool($nm,$def);
}
qtranxf_update_option_bool('qtrans_compatibility');
qtranxf_update_option_bool('disable_client_cookies');
Expand Down Expand Up @@ -1293,7 +1290,7 @@ function qtranxf_conf() {
<tr valign="top">
<th scope="row"><?php _e('Compatibility Functions', 'qtranslate');?></th>
<td>
<label for="qtranxs_qtrans_compatibility"><input type="checkbox" name="qtrans_compatibility" id="qtranxs_qtrans_compatibility" value="1"<?php checked($q_config['qtrans_compatibility']); ?>/>&nbsp;<?php printf(__('Enable function name compatibility (%s).', 'qtranslate'), 'qtrans_convertURL, qtrans_generateLanguageSelectCode, qtrans_getLanguage, qtrans_getLanguageName, qtrans_getSortedLanguages, qtrans_split, qtrans_use, qtrans_useCurrentLanguageIfNotFoundShowAvailable, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtrans_useDefaultLanguage, qtrans_useTermLib'); ?></label><br/>
<label for="qtranxs_qtrans_compatibility"><input type="checkbox" name="qtrans_compatibility" id="qtranxs_qtrans_compatibility" value="1"<?php checked($q_config['qtrans_compatibility']); ?>/>&nbsp;<?php printf(__('Enable function name compatibility (%s).', 'qtranslate'), 'qtrans_convertURL, qtrans_generateLanguageSelectCode, qtrans_getLanguage, qtrans_getLanguageName, qtrans_getSortedLanguages, qtrans_join, qtrans_split, qtrans_use, qtrans_useCurrentLanguageIfNotFoundShowAvailable, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtrans_useDefaultLanguage, qtrans_useTermLib'); ?></label><br/>
<small><?php printf(__('Some plugins and themes use direct calls to the functions listed, which are defined in former %s plugin and some of its forks. Turning this flag on will enable those function to exists, which will make the dependent plugins and themes to work. WordPress policy prohibits to define functions with the same names as in other plugins, since it generates user-unfriendly fatal errors, when two conflicting plugins are activated simultaneously. Before turning this option on, you have to make sure that there are no other plugins active, which define those functions.', 'qtranslate'), '<a href="https://wordpress.org/plugins/qtranslate/" target="_blank">qTranslate</a>'); ?></small>
</td>
</tr>
Expand Down Expand Up @@ -1366,7 +1363,7 @@ function qtranxf_conf() {
</fieldset><br />
<textarea id="highlight_mode_custom_css" name="highlight_mode_custom_css" style="width:100%"><?php echo esc_attr($highlight_mode_custom_css); ?></textarea>
<br />
<small><?php echo __('To reset to default, clear the text.', 'qtranslate').' '; printf(__('The color in use is taken from your profile option %s, the third color.', 'qtranslate'), '"<a href="'.admin_url('/profile.php').'">'.__('Admin Color Scheme', 'qtranslate').'</a>"') ?></small>
<small><?php echo __('To reset to default, clear the text.', 'qtranslate').' '; printf(__('The color in use is taken from your profile option %s, the third color.', 'qtranslate'), '"<a href="'.admin_url('/profile.php').'">'.__('Admin Color Scheme').'</a>"') ?></small>

This comment has been minimized.

Copy link
@pedro-mendonca

pedro-mendonca Mar 27, 2015

Contributor

Did you intentionally revert the textdomain or was in your previous code?

This comment has been minimized.

Copy link
@johnclause

johnclause Mar 27, 2015

Author Member

Yes, I reverted this place for now, until I hear a confirmation from you on #100 (comment).

</td>
</tr>
<?php /*
Expand Down
4 changes: 2 additions & 2 deletions qtranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: qTranslate-X
Plugin URI: http://wordpress.org/plugins/qtranslate-x/
Description: Adds user-friendly and database-friendly multilingual content support.
Version: 3.2.9.2
Version: 3.2.9.3
Author: qTranslate Team
Author URI: http://qtranslatexteam.wordpress.com/about
Tags: multilingual, multi, language, admin, tinymce, Polyglot, bilingual, widget, switcher, professional, human, translation, service, qTranslate, zTranslate, mqTranslate, qTranslate Plus, WPML
Expand Down Expand Up @@ -108,7 +108,7 @@
define( 'QTRANSLATE_FILE', __FILE__ );
}

define('QTX_VERSION','3.2.9.2');
define('QTX_VERSION','3.2.9.3');

require_once(dirname(__FILE__).'/qtranslate_options.php');
require_once(dirname(__FILE__).'/qtranslate_utils.php');
Expand Down
4 changes: 4 additions & 0 deletions qtranslate_compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function qtrans_getLanguageName($lang = ''){
if(!function_exists('qtrans_getSortedLanguages')){
function qtrans_getSortedLanguages($reverse = false){ return qtranxf_getSortedLanguages($reverse); }
}
function qtrans_join($texts) {
if(!is_array($texts)) $texts = qtranxf_split($texts);
qtranxf_join_b($texts);
}
if(!function_exists('qtrans_split')){
function qtrans_split($text, $quicktags = true){ return qtranxf_split($text); }
}
Expand Down
12 changes: 7 additions & 5 deletions qtranslate_core.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ function qtranxf_init_language() {
// fix url to prevent xss - how does this prevents xss?
//$q_config['url_info']['url'] = qtranxf_convertURL(add_query_arg('lang',$q_config['default_language'],$q_config['url_info']['url']));

//qtranslate_hooks.php has to go before load_plugin_textdomain()
require_once(dirname(__FILE__).'/qtranslate_hooks.php');//common hooks moved here from qtranslate.php since 3.2.9.2, because they all need language already detected

// load plugin translations
// since 3.2-b3 moved it here as https://codex.wordpress.org/Function_Reference/load_plugin_textdomain seem to recommend to run load_plugin_textdomain in 'plugins_loaded' action, which is this function respond to
load_plugin_textdomain('qtranslate', false, dirname(plugin_basename( __FILE__ )).'/lang');

require_once(dirname(__FILE__).'/qtranslate_hooks.php');//common hooks moved here from qtranslate.php since 3.2.9.2, because they all need language already detected
$lang_dir = dirname(plugin_basename( __FILE__ )).'/lang';
load_plugin_textdomain('qtranslate', false, $lang_dir);

if($q_config['url_info']['doing_front_end']) {
require_once(dirname(__FILE__)."/qtranslate_frontend.php");
Expand Down Expand Up @@ -454,7 +456,7 @@ function qtranxf_resolveLangCase($lang,&$caseredirect)

function qtranxf_load_option_qtrans_compatibility(){
global $q_config;
qtranxf_load_option_bool('qtrans_compatibility');
qtranxf_load_option_bool('qtrans_compatibility',false);
$q_config['qtrans_compatibility'] = apply_filters('qtranslate_compatibility', $q_config['qtrans_compatibility']);
if( !isset($q_config['qtrans_compatibility']) || !$q_config['qtrans_compatibility'] ) return;
require_once(dirname(__FILE__).'/qtranslate_compatibility.php');
Expand Down Expand Up @@ -1270,7 +1272,7 @@ function qtranxf_split($text, $quicktags = true) {
}// */
}

// not in use?
// not in use? QTranslate META calls 'qtrans_join' - added to compatibility
//function qtranxf_join($texts) {
// if(!is_array($texts)) $texts = qtranxf_split($texts);
// qtranxf_join_c($texts);
Expand Down
9 changes: 9 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ One can find the original qTranslate FAQ [here](https://wordpress.org/plugins/qt

## Changelog ##

### 3.3 stable ###
* Includes all changes after version 3.2.9.

### 3.2.9.3 ###
* Feature: `qtrans_join` added to option 'Compatibility Functions'. [[Issue #106](https://github.com/qTranslate-Team/qtranslate-x/issues/106)]
* Translation: Portuguese (pt_PT) po/mo files updated. Thanks to Pedro Mendonça.
* Fix: various problems with new option save/load methods.
* Fix: CSS syntax. Thanks to [Michel Weimerskirch](https://github.com/mweimerskirch): [Issue](https://github.com/qTranslate-Team/qtranslate-x/commit/83b4a9b513e623df3e9800888c742683c51eed6a#commitcomment-10435679).

### 3.2.9.2 ###
* Feature: option "LSB Style" to customize Language Switching Buttons style.
* Feature: after the first activation, the current WordPress active language becomes the default one for qTranslate-X, instead of English. No other languages are added anymore.
Expand Down

0 comments on commit 9aa751a

Please sign in to comment.