function theme_is_current_url($url) { // remove # anchor if (strpos($url, '#')) { $url = substr($url, 0, strpos($url, '#')); } $url = theme_remove_last_slash($url); $cur = theme_remove_last_slash(theme_get_current_url()); // compare return $cur == $url; }
function widget($args, $instance) { global $user_ID, $user_identity, $user_level, $user_email, $user_login; extract($args); echo $before_widget; echo $before_title; if ($user_ID) { echo $user_identity; echo $after_title; echo theme_get_avatar(array('id' => $user_email, 'size' => 64, 'url' => get_bloginfo('wpurl') . '/wp-admin/profile.php')); ?> <ul class="alignleft"> <li><a href="<?php bloginfo('wpurl'); ?> /wp-admin/"><?php _e('Dashboard', THEME_NS); ?> </a></li> <?php if ($user_level >= 1) { ?> <li><a href="<?php bloginfo('wpurl'); ?> /wp-admin/post-new.php"><?php _e('Publish', THEME_NS); ?> </a></li> <li><a href="<?php bloginfo('wpurl'); ?> /wp-admin/edit-comments.php"><?php _e('Comments', THEME_NS); ?> </a></li> <?php } ?> <li><a href="<?php echo wp_logout_url(); ?> &redirect_to=<?php echo urlencode(theme_get_current_url()); ?> "><?php _e("Log out", THEME_NS); ?> </a></li> </ul> <?php } else { _e('Log In', THEME_NS); echo $after_title; ?> <form action="<?php bloginfo('wpurl'); ?> /wp-login.php" method="post"> <label for="log"><?php _e('Username', THEME_NS); ?> </label><br /><input type="text" name="log" id="log" value="<?php echo esc_attr(stripslashes($user_login), 1); ?> " size="20" /><br /> <label for="pwd"><?php _e("Password", THEME_NS); ?> </label><br /><input type="password" name="pwd" id="pwd" size="20" /><br /> <span class="art-button-wrapper"> <span class="art-button-l"> </span> <span class="art-button-r"> </span> <input class="art-button" type="submit" name="submit" value="<?php echo esc_attr(__('Log In', THEME_NS)); ?> " class="button" /> </span> <br /> <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /><?php _e('Remember Me', THEME_NS); ?> </label><br /> <input type="hidden" name="redirect_to" value="<?php echo theme_get_current_url(); ?> "/> </form> <ul> <?php if (get_option('users_can_register')) { ?> <li><a href="<?php bloginfo('wpurl'); ?> /wp-register.php"><?php _e("Register", THEME_NS); ?> </a></li><?php } ?> <li><a href="<?php bloginfo('wpurl'); ?> /wp-login.php?action=lostpassword"><?php _e("Lost your password?", THEME_NS); ?> </a></li> </ul> <?php } ?> <?php echo $after_widget; }
function widget($args, $instance) { global $user_ID, $user_identity, $user_level, $user_email, $user_login; extract($args); echo $before_widget; echo $before_title; if ($user_ID) { echo $user_identity; echo $after_title; ?> <ul> <li><a href="<?php echo esc_url(site_url()); ?> /wp-admin/"><?php _e('Dashboard', THEME_NS); ?> </a></li> <?php if ($user_level >= 1) { ?> <li><a href="<?php echo esc_url(site_url()); ?> /wp-admin/post-new.php"><?php _e('Publish', THEME_NS); ?> </a></li> <li><a href="<?php echo esc_url(site_url()); ?> /wp-admin/edit-comments.php"><?php _e('Comments', THEME_NS); ?> </a></li> <?php } ?> <li><a href="<?php echo wp_logout_url(); ?> &redirect_to=<?php echo urlencode(theme_get_current_url()); ?> "><?php _e("Log out", THEME_NS); ?> </a></li> </ul> <?php } else { _e('Log In', THEME_NS); echo $after_title; ?> <form action="<?php echo esc_url(site_url()); ?> /wp-login.php" method="post" name="login" id="form-login"> <fieldset class="input" style="border: 0 none;"> <p id="form-login-username"> <label for="log"><?php _e('Username', THEME_NS); ?> </label> <br> <input type="text" name="log" id="log" value="<?php echo esc_attr(stripslashes($user_login), 1); ?> " size="20" /> </p> <p id="form-login-password"> <label for="pwd"><?php _e("Password", THEME_NS); ?> </label> <br> <input type="password" name="pwd" id="pwd" size="20" /><br /> </p> <p id="form-login-remember"> <label for="rememberme"><?php _e('Remember Me', THEME_NS); ?> </label> <input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> </p> <input class="bdls-button" type="submit" name="submit" value="<?php echo esc_attr(__('Log In', THEME_NS)); ?> " /> </fieldset> <input type="hidden" name="redirect_to" value="<?php echo theme_get_current_url(); ?> "/> </form> <ul> <?php if (get_option('users_can_register')) { ?> <li><a href="<?php echo esc_url(site_url()); ?> /wp-register.php"><?php _e("Register", THEME_NS); ?> </a></li> <?php } ?> <li><a href="<?php echo esc_url(site_url()); ?> /wp-login.php?action=lostpassword"><?php _e("Lost your password?", THEME_NS); ?> </a></li> </ul> <?php } echo $after_widget; }