Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Develop update to 1.5.6 (#14)
Browse files Browse the repository at this point in the history
* Added stripslashes (#12)

* Added BuddyDrive redirection (#13)

* Updated readme
  • Loading branch information
srdjan-jcc authored Aug 28, 2017
1 parent 2253f4e commit cddc5ff
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
30 changes: 30 additions & 0 deletions includes/class-bpml-compatibility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

class BPML_Compatibility {
function __construct() {
}

public function add_hooks() {
add_action( 'bp_init', array( $this, 'buddydrive'), 5 );
}

public function buddydrive() {
if ( class_exists( 'BuddyDrive' ) ) {
$bp_current_component = bp_current_component();
if ( $bp_current_component == 'buddydrive' ) {
add_filter( 'bpml_redirection_page_id', array( $this, 'buddydrive_redirection_page_filter' ), 10, 4 );
}
}
}

public function buddydrive_redirection_page_filter( $page_id, $bp_current_component, $bp_current_action, $bp_pages ) {
if ( $bp_current_component == 'buddydrive'
&& in_array( $bp_current_action, array( 'files', 'friends', 'members' ) )
&& isset( $bp_pages->members->id )
) {
$page_id = $bp_pages->members->id;
}

return $page_id;
}
}
16 changes: 8 additions & 8 deletions includes/class.xprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ public function saved_field_action( $field ) {
// Register name
if ( !empty( $field->name ) ) {
do_action( 'wpml_register_single_string', $this->_context,
"{$this->_field_string_prefix}{$field->id} name", $field->name );
"{$this->_field_string_prefix}{$field->id} name", stripslashes( $field->name ) );
}
// Register description
if ( !empty( $field->description ) ) {
do_action( 'wpml_register_single_string', $this->_context,
"{$this->_field_string_prefix}{$field->id} description", $field->description );
"{$this->_field_string_prefix}{$field->id} description", stripslashes( $field->description ) );
}
// Register options
if ( in_array( $field->type, array('radio', 'checkbox', 'selectbox', 'multiselectbox') ) ) {
Expand All @@ -83,12 +83,12 @@ public function saved_field_action( $field ) {
if ( !empty( $option->name ) ) {
do_action( 'wpml_register_single_string', $this->_context,
$this->sanitize_option_basename( $option, $field->id ) . ' name',
$option->name );
stripslashes( $option->name ) );
}
if ( !empty( $option->description ) ) {
do_action( 'wpml_register_single_string', $this->_context,
$this->sanitize_option_basename( $option, $field->id ) . ' description',
$option->description );
stripslashes( $option->description ) );
}
}
}
Expand Down Expand Up @@ -156,12 +156,12 @@ public function deleted_group_action( $group ) {

public function t_name( $name ) {
global $field;
return apply_filters( 'wpml_translate_single_string', $name, $this->_context, "{$this->_field_string_prefix}{$field->id} name" );
return stripslashes( apply_filters( 'wpml_translate_single_string', $name, $this->_context, "{$this->_field_string_prefix}{$field->id} name" ) );
}

public function t_description( $description ) {
global $field;
return apply_filters( 'wpml_translate_single_string', $description, $this->_context, "{$this->_field_string_prefix}{$field->id} description" );
return stripslashes( apply_filters( 'wpml_translate_single_string', $description, $this->_context, "{$this->_field_string_prefix}{$field->id} description" ) );
}

public function t_options( $options ) {
Expand All @@ -178,8 +178,8 @@ public function t_options( $options ) {

protected function _t_option_name( $option, $field_id ) {
if ( !empty( $option->name ) ) {
return apply_filters( 'wpml_translate_single_string', $option->name, $this->_context,
$this->sanitize_option_basename( $option, $field_id ) . ' name' );
return stripslashes( apply_filters( 'wpml_translate_single_string', $option->name, $this->_context,
$this->sanitize_option_basename( $option, $field_id ) . ' name' ) );
}
return isset( $option->name ) ? $option->name : '';
}
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: icanlocalize, jozik
Donate link: http://wpml.org/documentation/related-projects/buddypress-multilingual/
Tags: i18n, translation, localization, language, multilingual, WPML, BuddyPress
Requires at least: 3.9
Tested up to: 4.7.4
Stable tag: 1.5.5.2
Tested up to: 4.8.1
Stable tag: 1.5.6
License: GPLv2

BuddyPress Multilingual allows BuddyPress sites to run fully multilingual using the WPML plugin.
Expand Down Expand Up @@ -57,6 +57,10 @@ Support for language as parameter will not be added soon as we're looking for so

== Changelog ==

= 1.5.6 =
* Fixed escaping field name and description
* Added support for BuddyDrive plugin

= 1.5.5.2 =
* Minor bugfixes

Expand Down
8 changes: 6 additions & 2 deletions sitepress-bp.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
Description: BuddyPress Multilingual. <a href="http://wpml.org/?page_id=2890">Documentation</a>.
Author: OnTheGoSystems
Author URI: http://www.onthegosystems.com
Version: 1.5.5.2
Version: 1.5.6
*/

define( 'BPML_VERSION', '1.5.5.2' );
define( 'BPML_VERSION', '1.5.6' );
define( 'BPML_RELPATH', plugins_url( '', __FILE__ ) );
add_action( 'plugins_loaded', 'bpml_init', 11 );

Expand Down Expand Up @@ -57,6 +57,10 @@ function bpml_init() {
// XProfile
include_once dirname( __FILE__ ) . '/includes/class.xprofile.php';

include_once dirname( __FILE__ ) . '/includes/class-bpml-compatibility.php';
$bpml_compatibility = new BPML_Compatibility();
$bpml_compatibility->add_hooks();

}
} else if ( is_admin() ) {
add_action( 'admin_notices', 'bpml_admin_notice_required_plugins' );
Expand Down

0 comments on commit cddc5ff

Please sign in to comment.