Qtranslate Slug - Version 1.1.17

Version Description

= 1.0 = Major version, the plugin has been rewritten. Better performance, and some enhancements.

= 0.9 = This version fix some bugs and allow multilanguage in nav-menus.

= 0.8 = A lot of slugs content allowed

= 0.7 = This version allows TLD domain option for a different Qtranslate fork maded by Zappo

Download this release

Release Info

Developer pedroghandi
Plugin Icon wp plugin Qtranslate Slug
Version 1.1.17
Comparing to
See all releases

Code changes from version 1.1.14 to 1.1.17

includes/class-qtranslate-slug.php CHANGED
@@ -562,7 +562,12 @@ class QtranslateSlug {
562
 
563
  // remove from qtranslate the discouraged meta http-equiv, inline styles
564
  // (including flag URLs) and wrong hreflang links
 
565
  remove_action('wp_head', $this->get_plugin_prefix() . 'header');
 
 
 
 
566
  // add proper hreflang links
567
  add_action('wp_head',array(&$this, 'qtranslate_slug_header_extended'));
568
 
@@ -613,8 +618,10 @@ class QtranslateSlug {
613
  public function qtranslate_slug_header_extended(){
614
  if(is_404()) return;
615
 
616
-
 
617
  foreach($this->get_enabled_languages() as $language) {
 
618
  if($language != $this->get_currentlang() )
619
  echo '<link hreflang="'.$language.'" href="'.$this->get_current_url($language).'" rel="alternate" />'."\n";
620
  }
@@ -1101,7 +1108,7 @@ class QtranslateSlug {
1101
  foreach( $this->get_enabled_languages() as $lang ) {
1102
 
1103
  $this->lang = $lang;
1104
- $this->current_url[$lang] = apply_filters('qts_url_args', call_user_func($function, $id));
1105
  }
1106
 
1107
  $this->lang = false;
@@ -1308,7 +1315,6 @@ class QtranslateSlug {
1308
  if ( !$ignore_caller ) {
1309
  $url = call_user_func($this->get_plugin_prefix() . 'convertURL', $url, $this->get_lang(), true);
1310
  }
1311
- // if($this->default_language === $this->current_lang){ $url.="/en/" . ltrim( $path, '/' ); }
1312
 
1313
  return $url;
1314
  }
@@ -1919,11 +1925,14 @@ class QtranslateSlug {
1919
 
1920
  if ( function_exists( 'add_meta_box' ) ) {
1921
 
1922
- add_meta_box( 'qts_sectionid', __('Slug', 'qts'), array(&$this, 'draw_meta_box'), 'post', 'side', 'high');
1923
- add_meta_box( 'qts_sectionid', __('Slug', 'qts'), array(&$this, 'draw_meta_box'), 'page', 'side', 'high' );
 
 
 
1924
 
1925
  foreach ( get_post_types( array('_builtin' => false ) ) as $ptype )
1926
- add_meta_box( 'qts_sectionid', __('Slug', 'qts'), array(&$this, 'draw_meta_box'), $ptype, 'side', 'high' );
1927
  }
1928
  }
1929
 
@@ -2622,9 +2631,8 @@ class QtranslateSlug {
2622
  $url = $this->get_current_url($lang);
2623
  // 43LC: hack to play nice with qtranslate-x
2624
  if( "qtranxf_" === $this->plugin_prefix && $this->default_language === $lang ) {
2625
- $home_url_default = get_home_url();
2626
- $home_full_lang = $home_url_default."/$lang";
2627
- $url = str_replace($home_url_default,$home_full_lang ,$url);
2628
  }
2629
  $item_class = array();
2630
  if ( (string)$q_config['language'] == (string)$lang ) $item_class[] = 'current-menu-item';
562
 
563
  // remove from qtranslate the discouraged meta http-equiv, inline styles
564
  // (including flag URLs) and wrong hreflang links
565
+
566
  remove_action('wp_head', $this->get_plugin_prefix() . 'header');
567
+ if( "qtranxf_" === $this->get_plugin_prefix() ) {
568
+ remove_action('wp_head', $this->get_plugin_prefix() . 'head');
569
+ }
570
+
571
  // add proper hreflang links
572
  add_action('wp_head',array(&$this, 'qtranslate_slug_header_extended'));
573
 
618
  public function qtranslate_slug_header_extended(){
619
  if(is_404()) return;
620
 
621
+ //taken from qtx
622
+ echo '<link hreflang="x-default" href="'.$this->get_current_url($this->default_language) .'" rel="alternate" />'.PHP_EOL;
623
  foreach($this->get_enabled_languages() as $language) {
624
+
625
  if($language != $this->get_currentlang() )
626
  echo '<link hreflang="'.$language.'" href="'.$this->get_current_url($language).'" rel="alternate" />'."\n";
627
  }
1108
  foreach( $this->get_enabled_languages() as $lang ) {
1109
 
1110
  $this->lang = $lang;
1111
+ $this->current_url[$lang] = esc_url(apply_filters('qts_url_args', call_user_func($function, $id)));
1112
  }
1113
 
1114
  $this->lang = false;
1315
  if ( !$ignore_caller ) {
1316
  $url = call_user_func($this->get_plugin_prefix() . 'convertURL', $url, $this->get_lang(), true);
1317
  }
 
1318
 
1319
  return $url;
1320
  }
1925
 
1926
  if ( function_exists( 'add_meta_box' ) ) {
1927
 
1928
+ $context = apply_filters("qts_admin_meta_box_context","side");
1929
+ $priority = apply_filters("qts_admin_meta_box_priority","high");
1930
+
1931
+ add_meta_box( 'qts_sectionid', __('Slug', 'qts'), array(&$this, 'draw_meta_box'), 'post', $context, $priority);
1932
+ add_meta_box( 'qts_sectionid', __('Slug', 'qts'), array(&$this, 'draw_meta_box'), 'page', $context, $priority);
1933
 
1934
  foreach ( get_post_types( array('_builtin' => false ) ) as $ptype )
1935
+ add_meta_box( 'qts_sectionid', __('Slug', 'qts'), array(&$this, 'draw_meta_box'), $ptype, $context, $priority );
1936
  }
1937
  }
1938
 
2631
  $url = $this->get_current_url($lang);
2632
  // 43LC: hack to play nice with qtranslate-x
2633
  if( "qtranxf_" === $this->plugin_prefix && $this->default_language === $lang ) {
2634
+
2635
+ $url = qtranxf_convertURL('',$lang,false,true);
 
2636
  }
2637
  $item_class = array();
2638
  if ( (string)$q_config['language'] == (string)$lang ) $item_class[] = 'current-menu-item';
qtranslate-slug.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: qTranslate slug
4
  Plugin URI: http://not-only-code.github.com/qtranslate-slug/
5
  Description: Allows to define a slug for each language and some qTranslate bug fixes
6
- Version: 1.1.14
7
  Author: Carlos Sanz Garcia, Pedro Carvalho
8
  Author URI: http://github.com/not-only-code
9
  */
3
  Plugin Name: qTranslate slug
4
  Plugin URI: http://not-only-code.github.com/qtranslate-slug/
5
  Description: Allows to define a slug for each language and some qTranslate bug fixes
6
+ Version: 1.1.17
7
  Author: Carlos Sanz Garcia, Pedro Carvalho
8
  Author URI: http://github.com/not-only-code
9
  */
readme.txt CHANGED
@@ -3,24 +3,34 @@ Contributors: carlos_a_sanz, pedroghandi
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SYC46KSLRC4Q8
4
  Tags: qtranslate, slug, multilanguage, widget
5
  Requires at least: 3.3
6
- Tested up to: 4.1
7
- Stable tag: 1.1.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Adds support for permalink translations and fix some QTranslate deficiencies since wordpress 3.0
12
 
13
  == Description ==
14
 
15
- [Qtranslate](http://wordpress.org/plugins/qtranslate/) is a nice plugin but unfortunately today is **outdated**. **Qtranslate Slug** is an addon to QTranslate, which adds support for permalinks translations and fix some QTranslate deficiencies since wordpress 3.0. Check out all the new forks from qtranslate!
16
 
17
- **Version 1.0** has been written from scratch using OOP. The code has been structured better, the functions have been marked and commented and everything is better integrated with Wordpress API.
18
 
19
  = Requirements: =
20
 
21
  * Wordpress 3.3 (PHP 5.4 and MySQL 5)
22
  * mQtranslate 2.6.2.4 or Qtranslate 2.5.8 or qtranslate-x ( 2.9.1 )
23
 
 
 
 
 
 
 
 
 
 
 
24
  = New in 1.1.14 =
25
 
26
  The menu widget didn't allow the visitors to change to the default language if qtranslate-x was being used. So, adjusted the Language Menu widget to play nice with qtranslate-x.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SYC46KSLRC4Q8
4
  Tags: qtranslate, slug, multilanguage, widget
5
  Requires at least: 3.3
6
+ Tested up to: 4.2.4
7
+ Stable tag: 1.1.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Adds support for permalink translations to QTranslate-X since wordpress 3.0
12
 
13
  == Description ==
14
 
15
+ [Qtranslate-X](http://wordpress.org/plugins/qtranslate-x/) is a nice plugin for Multilingual Websites. **Qtranslate Slug** is an addon to QTranslate, which adds support for permalinks translations.
16
 
17
+ 1.1.17 fixes a dangerous Security Exploit. Please update right now!
18
 
19
  = Requirements: =
20
 
21
  * Wordpress 3.3 (PHP 5.4 and MySQL 5)
22
  * mQtranslate 2.6.2.4 or Qtranslate 2.5.8 or qtranslate-x ( 2.9.1 )
23
 
24
+ = New in 1.1.17 =
25
+ * Hability to filter the position of the Metabox
26
+ * Fixed dangerous security exploit!
27
+
28
+ = New in 1.1.16 =
29
+ Minor fix for the language menu using qtranslate's function
30
+
31
+ = New in 1.1.15 =
32
+ * Fixes the duplicated hreflang links in <head>
33
+
34
  = New in 1.1.14 =
35
 
36
  The menu widget didn't allow the visitors to change to the default language if qtranslate-x was being used. So, adjusted the Language Menu widget to play nice with qtranslate-x.
version.txt CHANGED
@@ -1,11 +1,18 @@
 
 
 
1
 
 
 
 
 
 
2
 
3
  = New in 1.1.14 =
4
 
5
  The menu widget didn't allow the visitors to change to the default language if qtranslate-x was being used. So, adjusted the Language Menu widget to play nice with qtranslate-x.
6
  Hope to bring some nice changes that were made in the github repository in the next version. For now, enjoy.
7
 
8
-
9
  = 1.1.13 =
10
  == Thanks to returning @pedro-mendonca for these commits: ==
11
  * Cleaned duplicated label in widget
1
+ = New in 1.1.17 =
2
+ * Fixed dangerous security exploit!
3
+ * Hability to filter the position of the Metabox
4
 
5
+ = New in 1.1.16 =
6
+ Minor fix for the language menu using qtranslate's function
7
+
8
+ = New in 1.1.15 =
9
+ * Fixes the duplicated hreflang links in <head>
10
 
11
  = New in 1.1.14 =
12
 
13
  The menu widget didn't allow the visitors to change to the default language if qtranslate-x was being used. So, adjusted the Language Menu widget to play nice with qtranslate-x.
14
  Hope to bring some nice changes that were made in the github repository in the next version. For now, enjoy.
15
 
 
16
  = 1.1.13 =
17
  == Thanks to returning @pedro-mendonca for these commits: ==
18
  * Cleaned duplicated label in widget