esc_html__( 'wpForo Menu', 'wpforo' ), ) ); function wpforo_login_url(){ global $wpforo; if(isset($wpforo->member_options['login_url']) && $wpforo->member_options['login_url']){ $wp_login_url = trim(get_bloginfo('url') , '/') . '/' . ltrim($wpforo->member_options['login_url'] , '/'); } else{ $wp_login_url = ((!is_wpforo_page() ? WPFORO_BASE_URL : '') . '?wpforo=signin'); } return esc_url($wp_login_url); } function wpforo_register_url(){ global $wpforo; if(isset($wpforo->member_options['register_url']) && $wpforo->member_options['register_url']){ $wp_register_url = trim(get_bloginfo('url') , '/') . '/' . ltrim($wpforo->member_options['register_url'] , '/'); } else{ $wp_register_url = WPFORO_BASE_URL . '?wpforo=signup'; } return esc_url($wp_register_url); } function wpforo_lostpass_url(){ global $wpforo; if(isset($wpforo->member_options['lost_password_url']) && $wpforo->member_options['lost_password_url']){ $wp_lostpass_url = trim(get_bloginfo('url') , '/') . '/' . ltrim($wpforo->member_options['lost_password_url'] , '/'); } else{ $wp_lostpass_url = wp_lostpassword_url( wpforo_full_url() ); } return esc_url($wp_lostpass_url); } function wpforo_menu_filter( $items, $menu ) { global $wpforo; if ( !is_admin() ) { foreach ( $items as $key => $item ) { if(isset($item->url)){ if( strpos($item->url, '%wpforo-') !== FALSE ){ $shortcode = trim(str_replace(array('https://', 'http://', '/', '%'), '', $item->url)); if(isset($wpforo->menu) && isset($wpforo->menu[$shortcode])){ if(isset($wpforo->menu[$shortcode]['href'])) $item->url = $wpforo->menu[$shortcode]['href']; if(isset($wpforo->menu[$shortcode]['attr']) && strpos($wpforo->menu[$shortcode]['attr'], 'wpforo-active') !== FALSE ) $item->classes[] = 'wpforo-active'; } else{ unset($items[$key]); } } } } } return $items; } add_filter( 'wp_get_nav_menu_items', 'wpforo_menu_filter', 1, 2 ); function wpforo_menu_nofollow_items($item_output, $item, $depth, $args) { if( isset($item->url) && strpos($item->url, '?wpforo') !== FALSE ) { $item_output = str_replace(' '.wpforo_phrase('Shop Account', false).' '; } if($url = wpforo_has_profile_plugin($userid)){ $menu_html .= '
'.wpforo_phrase('Site Profile', false).'
'; } $menu_html .= '
'.wpforo_phrase('Forum Profile', false).'
'; $menu_html .= "\r\n
\r\n"; $menu_html = apply_filters( 'wpforo_profile_plugin_menu_filter', $menu_html, $userid ); echo $menu_html; //This is a HTML content// } add_action( 'wpforo_profile_plugin_menu_action', 'wpforo_profile_plugin_menu', 1 ); class wpforo_menu_walker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent\n"; } public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $args = apply_filters( 'wpforo_nav_menu_item_args', $args, $item, $depth ); $class_names = join( ' ', apply_filters( 'wpforo_nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'wpforo_nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $atts = array(); $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; $atts['target'] = ! empty( $item->target ) ? $item->target : ''; $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; $atts['href'] = ! empty( $item->url ) ? $item->url : ''; $atts = apply_filters( 'wpforo_nav_menu_link_attributes', $atts, $item, $args, $depth ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $title = apply_filters( 'wpforo_the_title', $item->title, $item->ID ); $title = apply_filters( 'wpforo_nav_menu_item_title', $title, $item, $args, $depth ); $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . $title . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'wpforo_walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } public function end_el( &$output, $item, $depth = 0, $args = array() ) { $output .= ""; } } function wpforo_widgets_init() { register_sidebar(array( 'name' => __('wpForo Sidebar', 'wpforo'), 'description' => __("NOTE: If you're going to add widgets in this sidebar, please use 'Full Width' template for wpForo index page to avoid sidebar duplication.", 'wpforo'), 'id' => 'forum-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'wpforo_widgets_init', 11); class wpForo_Widget_search extends WP_Widget { function __construct() { parent::__construct( 'wpForo_Widget_search', // Base ID 'wpForo Search', // Name array( 'description' => 'wpForo search form' ) // Args ); } public function widget( $args, $instance ) { global $wpforo; echo $args['before_widget']; //This is a HTML content// echo ''; } } if( $echo ) { echo $edit_html; } else{ return $edit_html; } } function wpforo_hide_title($title, $id = 0) { global $wpforo; if( !wpforo_feature('page-title', $wpforo) ){ if( $wpforo_base_slug = basename(WPFORO_BASE_URL) ) $wpforo_page = get_page_by_path($wpforo_base_slug); if(!empty($wpforo_page)){ if (in_the_loop() && is_page($wpforo_page->ID) && $id == get_the_ID()) { $title = ''; } } } return $title; } add_filter('the_title', 'wpforo_hide_title', 10, 2); function wpforo_validate_gravatar( $email ) { $hashkey = md5(strtolower(trim($email))); $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; $data = wp_cache_get($hashkey); if (false === $data) { $response = wp_remote_head($uri); if( is_wp_error($response) ) { $data = 'not200'; } else { $data = $response['response']['code']; } wp_cache_set($hashkey, $data, $group = '', $expire = 60*5); } if ($data == '200'){ return true; } else { return false; } } function wpforo_member_title( $member = array(), $echo = true ){ global $wpforo; if(empty($member) || !$member['groupid']) return; $enabled_for_usergroup = ( isset($wpforo->member_options['rating_title_ug'][$member['groupid']]) && $wpforo->member_options['rating_title_ug'][$member['groupid']] ) ? true : false ; if( wpforo_feature('rating_title', $wpforo) && $enabled_for_usergroup ){ $title = esc_html($member['stat']['title']); } else{ $title = wpforo_phrase($member['title']); } if( $echo ) { echo $title; } else{ return $title; } } function wpforo_member_badge( $member = array(), $sep = '', $type = 'full' ){ global $wpforo; $enabled_for_usergroup = ( isset($wpforo->member_options['rating_badge_ug'][$member['groupid']]) && $wpforo->member_options['rating_badge_ug'][$member['groupid']] ) ? true : false ; if( wpforo_feature('rating', $wpforo) && $enabled_for_usergroup ): ?>
member->rating_badge($member['stat']['rating'], $type); ?>