$item ) { $x1 = wp_specialchars_decode($item->url); $p1 = strpos(strtolower($x1), ADSSCM_LOGINOUT); if ($p1 !== false) { // found loginmenucode $l1 = strlen(ADSSCM_LOGINOUT); $login = __('Sign in'); $logout = __('Sign out'); //check titlestring with language $x2 = wp_specialchars_decode($item->title); $gl = get_locale()." "; // search 2 chars language code $lang = strtolower('{'.substr($gl,0,2).'}'); $l2 = strlen($lang); $p2 = strpos(strtolower($x2), $lang); if ($p2 === false) { // search for 5 chars language code $lang = strtolower('{'.substr($gl,0,5).'}'); $l2 = strlen($lang); $p2 = strpos(strtolower($x2), $lang); } if ($p2 !== false) { // found on title, use it $z = explode(";", substr($x2, $p2+$l2).';', 3); $login = $z[0]; $logout = $z[1]; } else { // search on url $p2 = strpos($x1,';'); $p2 = strpos($x1,';'); if ($p2 !== false && $p2 > $l1){ $login = substr($x1, $l1, $p2-$l1); $logout = substr($x1, $p2+1); } } if ( ! is_user_logged_in() ) { $item->title = $item->attr_title = $item->post_title = $login; $item->url = esc_url( wp_login_url('index.php') ); } else { $item->title = $item->attr_title = $item->post_title = $logout; $item->url = esc_url( wp_logout_url('index.php') ) ; } } if (adsscm_startsWith($x1, '[') ) { //url href $item->url = do_shortcode( $x1 ); } $x1 = wp_specialchars_decode($item->title); if (adsscm_startsWith($x1, '[') ) { // normal titel used $item->title = do_shortcode( $x1 ); } // artisteer4 like this as text, unknown why not title $x1 = wp_specialchars_decode($item->post_title); if (adsscm_startsWith($x1, '[') ) { $item->post_title = do_shortcode( $x1 ); } } return $items; } //================================= function adsscm_startsWith($haystack, $needle) { return $needle === "" || strpos($haystack, $needle) === 0; } ?>