[Reddes] [WordPress Plugin][432518] multi-language-framework/trunk: [fix] parse query for child pages
Victor Ricardo Díaz
victorr at infomed.sld.cu
Mon Oct 3 19:34:03 BRST 2011
Hola Vinicius, la actualización de que url la tomamos:
De esta http://wordpress.org/extend/plugins/multi-language-framework/
o
https://github.com/viniciusandrade/wp-multi-language-framework
Abrazos
Victor Ricardo
CNICM - INFOMED
----- Original Message -----
From: Vinicius Andrade
To: reddes at listas.bireme.br
Sent: Monday, October 03, 2011 3:50 PM
Subject: [Reddes] [WordPress Plugin][432518] multi-language-framework/trunk: [fix] parse query for child pages
Victor y amigos de reddes,
Hemos identificado y corrigido un problema en el plugin de multi-language que no permitia el display de las páginas secundarias.
Es importante actualizar el plugin para poder trabajar con las paginas secundarias generadas en el plugin de BVS-Site.
Abrazos,
Vinicius de Andrade
BIREME/OPAS/OMS
---------- Forwarded message ----------
From: <noreply at wordpress.org>
Date: Fri, Sep 2, 2011 at 4:44 PM
Subject: [WordPress Plugin][432518] multi-language-framework/trunk: [fix] parse query for child pages
To: vinicius.andrade at bireme.org
Log Message
[fix] parse query for child pages
[fix] page translation supports page attributesModified Paths
a.. multi-language-framework/trunk/parse_query.php
b.. multi-language-framework/trunk/post_types.php
Diff
Modified: multi-language-framework/trunk/parse_query.php (432517 => 432518)
--- multi-language-framework/trunk/parse_query.php 2011-09-02 19:41:05 UTC (rev 432517)
+++ multi-language-framework/trunk/parse_query.php 2011-09-02 19:44:16 UTC (rev 432518)
@@ -37,15 +37,19 @@
// because we changed the REQUEST_URI so it doesnt know
if ($wp_query->query_vars['pagename']) {
+ //lets check if there are slashes in the page name, that means a child
+ $pagename = $wp_query->query_vars['pagename'];
+ $pagename = str_replace( dirname($pagename) . '/', '', $pagename);
+
global $wpdb;
- $post_type = $wpdb->get_var( $wpdb->prepare("SELECT post_type FROM $wpdb->posts WHERE post_name = %s", $wp_query->query_vars['pagename']) );
+ $post_type = $wpdb->get_var( $wpdb->prepare("SELECT post_type FROM $wpdb->posts WHERE post_name = %s", $pagename) );
$wp_query->query_vars['post_type'] = $post_type;
//$wp_query->query_vars['post_type'] = $post_type . '_t_' . $mlf_config['current_language'];
- $wp_query->query_vars['name'] = $wp_query->query_vars['pagename'];
+ $wp_query->query_vars['name'] = $pagename;
$wp_query->query_vars[$wp_query->query_vars['post_type']] = $wp_query->query_vars['name'];
- $wp_query->query_vars['pagename'] = '';
+ $pagename = '';
$wp_query->is_page = false;
$wp_query->is_single = true;
@@ -54,7 +58,7 @@
'post_type' => $post_type,
//'post_type' => $post_type . '_t_' . $mlf_config['current_language'],
- 'name' => $wp_query->query_vars['pagename'],
+ 'name' => $pagename,
$wp_query->query_vars['post_type'] => $wp_query->query_vars['name']
);
Modified: multi-language-framework/trunk/post_types.php (432517 => 432518)
--- multi-language-framework/trunk/post_types.php 2011-09-02 19:41:05 UTC (rev 432517)
+++ multi-language-framework/trunk/post_types.php 2011-09-02 19:44:16 UTC (rev 432518)
@@ -28,12 +28,15 @@
case 'post':
$menu_pos = 5;
+ $p_type_supports = array('title','editor','author','thumbnail','excerpt','comments');
break;
case 'page':
$menu_pos = 20;
+ $p_type_supports = array('title','editor','author','thumbnail','excerpt','comments', 'page-attributes');
break;
default:
$menu_pos = $wp_post_types[$p_type]->menu_position ? $wp_post_types[$p_type]->menu_position : 25;
+ $p_type_supports = array('title','editor','author','thumbnail','excerpt','comments');
}
@@ -44,7 +47,7 @@
'capability_type' => $wp_post_types[$p_type]->capability_type,
'hierarchical' => $wp_post_types[$p_type]->hierarchical == 1,
'menu_position' => $menu_pos,
- 'supports' => array('title','editor','author','thumbnail','excerpt','comments')
+ 'supports' => $p_type_supports
);
//TODO: Post types names can only have 20 chars. Ho to deal with it?
@@ -163,9 +166,7 @@
if ($_GET['action'] != 'edit') {
$translation_of = $_GET['translation_of'];
} else {
- $translation_of = get_post_meta($post->ID, '_translation_of');
- if (is_array($translation_of))
- $translation_of = $translation_of[0];
+ $translation_of = get_post_meta($post->ID, '_translation_of', true);
}
@@ -241,9 +242,9 @@
mlf_add_post_meta($new, '_translation_of', $original);
#var_dump($original, $new); die;
-
+
$also_translation_of = get_post_meta($original, '_translation_of');
-
+
if (is_array($also_translation_of)) {
foreach ($also_translation_of as $a) {
if ($a != $new) {
@@ -267,11 +268,8 @@
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id;
- if ( 'post' == $_POST['post_type'] ) {
- if ( !current_user_can( 'edit_post', $post_id ) )
- return $post_id;
- }
+
#var_dump($_POST['_translation_of']); die;
mlf_add_translation_relationship($_POST['_translation_of'], $post_id);
------------------------------------------------------------------------------
_______________________________________________
Reddes mailing list
Reddes at listas.bireme.br
http://listas.bireme.br/mailman/listinfo/reddes
__________ Informacisn de ESET Smart Security, versisn de la base de firmas de virus 6513 (20111003) __________
ESET Smart Security ha comprobado este mensaje.
http://www.eset.com
__________ Información de ESET Smart Security, versión de la base de firmas de virus 6513 (20111003) __________
ESET Smart Security ha comprobado este mensaje.
http://www.eset.com
--
Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas
Infomed: http://www.sld.cu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.bireme.br/pipermail/reddes/attachments/20111003/a01d25eb/attachment-0001.html
More information about the Reddes
mailing list