- small PHP notices fixes;

This commit is contained in:
nikitasinelnikov
2020-08-12 00:56:06 +03:00
parent dc281c2c0d
commit eeadc4ac89
3 changed files with 18 additions and 11 deletions
@@ -269,8 +269,9 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
function get_languages_codes( $current_code = false ) {
global $sitepress;
if ( ! $this->is_wpml_active() )
if ( ! $this->is_wpml_active() ) {
return $current_code;
}
$current_code = ! empty( $current_code ) ? $current_code : $sitepress->get_current_language();
+1 -1
View File
@@ -32,7 +32,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
function um_on_roles_update( $option, $old_value, $value ) {
global $wp_roles;
if ( $option == $wp_roles->role_key ) {
if ( isset( $wp_roles->role_key ) && $option == $wp_roles->role_key ) {
foreach ( $value as $role_key => $role_data ) {
$role_keys = get_option( 'um_roles', array() );
$role_keys = array_map( function( $item ) {
+15 -9
View File
@@ -1336,25 +1336,28 @@ function um_is_core_page( $page ) {
return false;
}
if ( isset( $post->ID ) && isset( UM()->config()->permalinks[ $page ] ) && $post->ID == UM()->config()->permalinks[ $page ] )
if ( isset( $post->ID ) && isset( UM()->config()->permalinks[ $page ] ) && $post->ID == UM()->config()->permalinks[ $page ] ) {
return true;
}
if ( isset( $post->ID ) && get_post_meta( $post->ID, '_um_wpml_' . $page, true ) == 1 )
if ( isset( $post->ID ) && get_post_meta( $post->ID, '_um_wpml_' . $page, true ) == 1 ) {
return true;
}
if ( UM()->external_integrations()->is_wpml_active() ) {
global $sitepress;
if ( UM()->config()->permalinks[ $page ] == wpml_object_id_filter( $post->ID, 'page', true, $sitepress->get_default_language() ) ) {
if ( isset( UM()->config()->permalinks[ $page ] ) && UM()->config()->permalinks[ $page ] == wpml_object_id_filter( $post->ID, 'page', true, $sitepress->get_default_language() ) ) {
return true;
}
}
if (isset( $post->ID )) {
if ( isset( $post->ID ) ) {
$_icl_lang_duplicate_of = get_post_meta( $post->ID, '_icl_lang_duplicate_of', true );
if (isset( UM()->config()->permalinks[$page] ) && ( ( $_icl_lang_duplicate_of == UM()->config()->permalinks[$page] && !empty( $_icl_lang_duplicate_of ) ) || UM()->config()->permalinks[$page] == $post->ID ))
if ( isset( UM()->config()->permalinks[ $page ] ) && ( ( $_icl_lang_duplicate_of == UM()->config()->permalinks[ $page ] && !empty( $_icl_lang_duplicate_of ) ) || UM()->config()->permalinks[ $page ] == $post->ID ) ) {
return true;
}
}
return false;
}
@@ -1367,17 +1370,20 @@ function um_is_core_page( $page ) {
* @return bool
*/
function um_is_core_post( $post, $core_page ) {
if (isset( $post->ID ) && isset( UM()->config()->permalinks[$core_page] ) && $post->ID == UM()->config()->permalinks[$core_page])
if ( isset( $post->ID ) && isset( UM()->config()->permalinks[ $core_page ] ) && $post->ID == UM()->config()->permalinks[ $core_page ] ) {
return true;
if (isset( $post->ID ) && get_post_meta( $post->ID, '_um_wpml_' . $core_page, true ) == 1)
}
if ( isset( $post->ID ) && get_post_meta( $post->ID, '_um_wpml_' . $core_page, true ) == 1 ) {
return true;
}
if (isset( $post->ID )) {
if ( isset( $post->ID ) ) {
$_icl_lang_duplicate_of = get_post_meta( $post->ID, '_icl_lang_duplicate_of', true );
if (isset( UM()->config()->permalinks[$core_page] ) && ( ( $_icl_lang_duplicate_of == UM()->config()->permalinks[$core_page] && !empty( $_icl_lang_duplicate_of ) ) || UM()->config()->permalinks[$core_page] == $post->ID ))
if ( isset( UM()->config()->permalinks[ $core_page ] ) && ( ( $_icl_lang_duplicate_of == UM()->config()->permalinks[ $core_page ] && ! empty( $_icl_lang_duplicate_of ) ) || UM()->config()->permalinks[ $core_page ] == $post->ID ) ) {
return true;
}
}
return false;
}