wpforo)) $this->wpforo = $wpForo; $this->init_defaults(); $this->init_options(); $this->init_hooks(); } private function init_hooks(){ if( is_wpforo_page() ){ add_filter("mce_external_plugins", array(&$this, 'add_tinymce_buttons'), 15); add_filter("tiny_mce_plugins", array(&$this, 'filter_tinymce_plugins'), 15); add_filter("wp_mce_translation", array(&$this, 'add_tinymce_translations')); } } private function init_defaults(){ $this->default = new stdClass; $this->default->style = array( 'font_size_forum' => 17, 'font_size_topic' => 16, 'font_size_post_content' => 14, 'custom_css' => "#wpforo-wrap {\r\n font-size: 13px; width: 100%; padding:10px 20px; margin:0px;\r\n}\r\n" ); $theme = $this->find_theme( 'classic' ); if( $current_theme = get_option('wpforo_theme_options') ) $theme = wpforo_deep_merge($theme, $current_theme); $this->default->options = $theme; } private function init_options(){ $this->style = get_wpf_option('wpforo_style_options', $this->default->style); $this->options = get_wpf_option('wpforo_theme_options', $this->default->options); $this->theme = $this->options['folder']; $this->init_defines(); } private function init_defines(){ define('WPFORO_THEME', $this->theme ); define('WPFORO_TEMPLATE_DIR', WPFORO_THEME_DIR . '/' . $this->theme ); define('WPFORO_TEMPLATE_URL', WPFORO_THEME_URL . '/' . $this->theme ); } function add_tinymce_buttons($plugin_array) { $plugin_array = array(); $plugin_array['wpforo_pre_button'] = WPFORO_URL . '/wpf-assets/js/tinymce-pre.js'; $plugin_array['wpforo_link_button'] = WPFORO_URL . '/wpf-assets/js/tinymce-link.js'; $plugin_array['wpforo_source_code_button'] = WPFORO_URL . '/wpf-assets/js/tinymce-code.js'; return $plugin_array; } function filter_tinymce_plugins($plugins){ return array('hr','lists','textcolor','paste'); } function add_tinymce_translations($mce_translation){ $mce_translation['Insert link'] = __( 'Insert link' ); $mce_translation['Link Text'] = __( 'Link Text' ); $mce_translation['Open link in a new tab'] = __( 'Open link in a new tab' ); return $mce_translation; } function topic_form($forumid){ if(!isset($this->wpforo->post->options['max_upload_size']) || !$this->wpforo->post->options['max_upload_size']){ $server_mus = wpforo_human_size_to_bytes(ini_get('upload_max_filesize')); if( !$server_mus || $server_mus > 10485760 ) $server_mus = 10485760; $this->wpforo->post->options['max_upload_size'] = $server_mus;} ?>
true,// use wpautop? 'media_buttons'=> FALSE,// show insert / upload button(s) 'textarea_name'=> $editor_id,// set the textarea name to something different, square brackets [] can be used here 'textarea_rows'=> get_option('default_post_edit_rows', 20),// rows = "..." 'tabindex'=> '', 'editor_height' => '180', 'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the < style > tags, can use "scoped". 'editor_class'=> '', // add extra class(es) to the editor textarea 'teeny'=> FALSE, // output the minimal editor config used in Press This 'dfw'=> false, // replace the default fullscreen with DFW (supported on the front - end in WordPress 3.4) 'tinymce'=> array( 'toolbar1' => 'bold,italic,underline,strikethrough,forecolor,bullist,numlist,hr,alignleft,aligncenter,alignright,alignjustify,link,unlink,blockquote,pre,undo,redo,pastetext,source_code', 'toolbar2' => '', 'toolbar3' => '', 'toolbar4' => '', 'content_style' => 'blockquote{border: #cccccc 1px dotted; background: #F7F7F7; padding:10px;font-size:12px; font-style:italic; margin: 20px 10px;}', 'object_resizing' => false ), // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() 'quicktags'=> true, // load Quicktags, can be used to pass settings directly to Quicktags using an array() 'default_editor' => 'tinymce' ); wp_editor( $content, $editor_id, $settings ); ?>
wpforo->perm->forum_can('s', $forumid)) : ?>         |   wpforo->perm->forum_can('p', $forumid) || $this->wpforo->perm->forum_can('op', $forumid)) : ?>         |     
wpforo->perm->can_attach() ): ?> wpforo->perm->forum_can('a', $forumid)): ?>

wpforo->post->options['max_upload_size']); ?>

wpforo) ) : ?>
wpforo) ) ? 'checked="true" ' : ''; ?>/> 
$topic['closed'], // is topic closed or opened (values 1 or 0) * "topicid" => $topic['topicid'], // the id of topic * "forumid" => $forum_data['forumid'], * "layout" => $cat_layout, * "topic_title" => $topic['title'] // the title of topic * ); * * @return html form */ function reply_form($args){ extract($args, EXTR_OVERWRITE); ?> '.wpforo_phrase('Leave a reply', false).'

'; $head_html = apply_filters( 'wpforo_reply_form_head', $head_html, $args ); if(!isset($this->wpforo->post->options['max_upload_size']) || !$this->wpforo->post->options['max_upload_size']){$server_mus = wpforo_human_size_to_bytes(ini_get('upload_max_filesize')); if( !$server_mus || $server_mus > 10485760 ) $server_mus = 10485760; $this->wpforo->post->options['max_upload_size'] = $server_mus;} ?>

true,// use wpautop? 'media_buttons'=> FALSE,// show insert / upload button(s) 'textarea_name'=> $editor_id,// set the textarea name to something different, square brackets [] can be used here 'textarea_rows'=> get_option('default_post_edit_rows', 5),// rows = "..." 'editor_class'=> 'wpeditor', // add extra class(es) to the editor textarea 'teeny'=> false, // output the minimal editor config used in Press This 'dfw'=> false, // replace the default fullscreen with DFW (supported on the front - end in WordPress 3.4) 'editor_height' => '180', 'tinymce'=> array( 'toolbar1' => 'bold,italic,underline,strikethrough,forecolor,bullist,numlist,hr,alignleft,aligncenter,alignright,alignjustify,link,unlink,blockquote,pre,undo,redo,pastetext,source_code', 'toolbar2' => '', 'toolbar3' => '', 'toolbar4' => '', 'content_style' => 'blockquote{border: #cccccc 1px dotted; background: #F7F7F7; padding:10px;font-size:12px; font-style:italic; margin: 20px 10px;}', 'object_resizing' => false ), // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() 'quicktags'=> true, // load Quicktags, can be used to pass settings directly to Quicktags using an array() 'default_editor' => 'tinymce', // load Quicktags, can be used to pass settings directly to Quicktags using an array() ); wp_editor( $content, $editor_id, $settings ); ?>
   wpforo->perm->can_attach() ): ?> wpforo->perm->forum_can('a', $forumid)): ?>

wpforo->post->options['max_upload_size']); ?>

wpforo) ) : $args = array( "userid" => $this->wpforo->current_userid , "itemid" => intval($topicid), "type" => "topic" ); $subscribe = $this->wpforo->sbscrb->get_subscribe( $args ); if( !isset($subscribe['subid']) ) : ?>
wpforo) ) ? 'checked="true" ' : ''; ?> /> 
wpforo->current_object['template'] == 'topic' ? $this->wpforo->post->options['topics_per_page'] : $this->wpforo->post->options['posts_per_page'] ); if($items_count <= $items_per_page) return; $pages_count = ceil($items_count/$items_per_page); if($permalink){ $url = trim( preg_replace('#\/paged\/[\d]+\/*.*$#is', '', wpforo_get_request_uri()), '/' ) . '/paged/'; }else{ $url = trim( preg_replace('#[\&\?]wpfpaged=[\d]*.*$#is', '', wpforo_get_request_uri()), '/' ); $url .= (strpos($url, '?') === FALSE ? '?' : '&') . 'wpfpaged='; } ?>
/ 0 ): ?>
wpforo->current_userid) $l_usernames[0]['display_name'] = wpforo_phrase('You', FALSE); if($l_count == 1){ $return = sprintf( wpforo_phrase('%s liked', FALSE), ''.esc_html($l_usernames[0]['display_name']).'' ); }elseif($l_count == 2){ $return = sprintf( wpforo_phrase('%s and %s liked', FALSE), ''.esc_html($l_usernames[0]['display_name']).'', ''.esc_html($l_usernames[1]['display_name']).'' ); }elseif($l_count == 3){ $return = sprintf( wpforo_phrase('%s, %s and %s liked', FALSE), ''.esc_html($l_usernames[0]['display_name']).'', ''.esc_html($l_usernames[1]['display_name']).'', ''.esc_html($l_usernames[2]['display_name']).'' ); }elseif($l_count >= 4){ $l_count = $l_count - 3; $return = sprintf( wpforo_phrase('%s, %s, %s and %d people liked', FALSE), ''.esc_html($l_usernames[0]['display_name']).'', ''.esc_html($l_usernames[1]['display_name']).'', ''.esc_html($l_usernames[2]['display_name']).'', $l_count ); } } return $return; } /** * Get actions buttons * * @since 1.0.0 * * @param array buttons names function will return buttons by this array * * @param array $forum required * * @param array $topic required * * @param array $post required * * @param int $is_topic required this is a first post in the loop * * $buttons = array( 'reply', 'answer', 'comment', 'quote', 'like', 'report', 'sticky', 'close', 'move', 'edit', 'delete', 'link' ); * * @return html ( buttons ) */ function buttons( $buttons, $forum = array(), $topic = array(), $post = array(), $is_topic = FALSE ){ $button_html = array(); $forumid = (isset($forum['forumid'])) ? $forum['forumid'] : 0; $topicid = (isset($topic['topicid'])) ? $topic['topicid'] : 0; $postid = (isset($post['postid'])) ? $post['postid'] : 0; $is_sticky = (isset($topic['type'])) ? $topic['type'] : 0; $is_closed = (isset($topic['closed'])) ? $topic['closed'] : 0; $is_private = (isset($topic['private'])) ? $topic['private'] : 0; $is_solved = (isset($post['is_answer'])) ? $post['is_answer'] : 0; $is_approve = (isset($post['status'])) ? $post['status'] : 0; foreach($buttons as $button){ switch($button){ case 'reply': if($is_closed) break; if( $this->wpforo->perm->forum_can('cr', $forumid) ){ $button_html[] = '' . wpforo_phrase('Reply', false).''; }else{ $button_html[] = ' ' . wpforo_phrase('Reply', false).''; } break; case 'answer': if( $this->wpforo->perm->forum_can('cr', $forumid) ){ $button_html[] = ' ' . wpforo_phrase('Answer', false).''; }else{ $button_html[] = ' ' . wpforo_phrase('Answer', false).''; } break; case 'comment': if($is_closed) break; $title = wpforo_phrase('Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.', false); if( $this->wpforo->perm->forum_can('cr', $forumid) ) { $button_html[] = ' ' . wpforo_phrase('Add a comment', false).''; }else{ $button_html[] = ' ' . wpforo_phrase('Add a comment', false).''; } break; case 'quote': if($is_closed) break; if( $this->wpforo->perm->forum_can('cr', $forumid) ) { $button_html[] = '' . wpforo_phrase('Quote', false).''; }else{ $button_html[] = '' . wpforo_phrase('Quote', false).''; } break; case 'like': if( $this->wpforo->perm->forum_can('l', $forumid) ) { $like_status = ( $this->wpforo->post->is_liked( $postid, $this->wpforo->current_userid ) === FALSE ? 'wpforo-like' : 'wpforo-unlike' ); $like_icon = ( $like_status == 'wpforo-like') ? 'up' : 'down'; $button_html[] = '' . wpforo_phrase( str_replace('wpforo-', '', $like_status), false) . ''; } break; case 'report': if( $this->wpforo->perm->forum_can('r', $forumid) ) { $button_html[] = '' . wpforo_phrase('Report', false).''; } break; case 'sticky': if( $this->wpforo->perm->forum_can('s', $forumid) ) { $sticky_status = ( $is_sticky ? 'wpforo-unsticky' : 'wpforo-sticky'); $button_html[] = '' . wpforo_phrase( str_replace('wpforo-', '', $sticky_status), false).''; } break; case 'private': if( $this->wpforo->perm->forum_can('p', $forumid) || ($this->wpforo->current_userid == $post['userid'] && $this->wpforo->perm->forum_can('op', $forumid)) ) { $private_status = ( $is_private ? 'wpforo-public' : 'wpforo-private'); $private_icon = ( $private_status == 'wpforo-public') ? 'eye' : 'eye-slash'; $button_html[] = '' . wpforo_phrase( str_replace('wpforo-', '', $private_status), false).''; } break; case 'solved': if( $this->wpforo->perm->forum_can('sv', $forumid) || ($this->wpforo->current_userid == $post['userid'] && $this->wpforo->perm->forum_can('osv', $forumid)) ) { $solved_status = ( $is_solved ? 'wpforo-unsolved' : 'wpforo-solved'); $button_html[] = '' . wpforo_phrase( str_replace('wpforo-', '', $solved_status), false).''; } break; case 'approved': if( $this->wpforo->perm->forum_can('au', $forumid) ) { $approve_status = ( !$is_approve ? 'wpforo-unapprove' : 'wpforo-approve'); $approve_icon = ( $approve_status == 'wpforo-unapprove') ? 'fa-exclamation-circle' : 'fa-check'; $button_html[] = '' . wpforo_phrase( str_replace('wpforo-', '', $approve_status), false).''; } break; case 'close': if( $this->wpforo->perm->forum_can('cot', $forumid) ) { $open_status = ( $is_closed ? 'wpforo-open' : 'wpforo-close' ); $open_icon = ($open_status == 'wpforo-open') ? 'unlock' : 'lock'; $button_html[] = '' . wpforo_phrase( str_replace('wpforo-', '', $open_status), false).''; } break; case 'move': if( $this->wpforo->perm->forum_can('mt', $forumid) ) { $button_html[] = '' . wpforo_phrase('Move', false).''; } break; case 'edit': if($is_closed) break; if( $this->wpforo->member->current_user_is_new() && $post['status'] ){ //New registered user's unapproved topic/post | No Edit button. } else{ $diff = current_time( 'timestamp', 1 ) - strtotime($post['created']); if( $this->wpforo->perm->forum_can( ($is_topic ? 'et' : 'er'), $forumid ) || ($this->wpforo->current_userid == $post['userid'] && $this->wpforo->perm->forum_can( ($is_topic ? 'eot' : 'eor' ), $forumid ) && $diff < $this->wpforo->post->options[($is_topic ? 'eot' : 'eor' ).'_durr'] ) ) { $a = ( $is_topic ) ? 'wpfedittopicpid' : ''; $b = ( $is_topic ) ? $postid : $postid; $button_html[] = '' . wpforo_phrase('Edit', false).''; } } break; case 'delete': if( $this->wpforo->member->current_user_is_new() && $post['status'] ){ //New registered user's unapproved topic/post | No Delete button. } else{ $diff = current_time( 'timestamp', 1 ) - strtotime($post['created']); if( $this->wpforo->perm->forum_can( ($is_topic ? 'dt' : 'dr' ), $forumid ) || ($this->wpforo->current_userid == $post['userid'] && $this->wpforo->perm->forum_can( ($is_topic ? 'dot' : 'dor' ), $forumid ) && $diff < $this->wpforo->post->options[($is_topic ? 'dot' : 'dor' ).'_durr']) ){ $a = ( $is_topic ) ? 'wpftopicdelete' : 'wpfreplydelete'; $b = ( $is_topic ) ? $topicid : $postid; $button_html[] = '' . wpforo_phrase('Delete', false).''; } } break; case 'link': $url = ( $is_topic ) ? $this->wpforo->topic->get_topic_url( $topic ) : wpforo_post( $postid, 'url' ); $button_html[] = ''; break; case 'positivevote': if( $this->wpforo->perm->forum_can('v', $forumid) ) { $button_html[] = ''; }else{ $button_html[] = ''; } break; case 'negativevote': if( $this->wpforo->perm->forum_can('v', $forumid) ) { $button_html[] = ''; }else{ $button_html[] = ''; } break; case 'isanswer': $is_answer = $this->wpforo->post->is_answered( $postid ); $is_answer = ( $is_answer == 0 ) ? '-not' : ''; if( is_user_logged_in() ){ $button_html[] = '
'; }else{ $button_html[] = '
'; } break; } //switch } //foreach echo implode('', $button_html); } function breadcrumb($url_data){ extract($url_data, EXTR_OVERWRITE); switch($template) : case 'search': ?>
 
 
 
 
 
 
 
 
 
wpforo->forum->get_all_relative_ids($forumid, $relative_ids); foreach( $relative_ids as $key => $rel_forumid ) : ?>  
wpforo->forum->get_all_relative_ids($forumid, $relative_ids); foreach( $relative_ids as $key => $rel_forumid ) : ?>  
 
wpforo->topic->is_private($item['topicid'])){ $icon['class'] = 'fa-eye-slash'; $icon['color'] = 'wpfcl-1'; $icon['title'] = wpforo_phrase('Private', false); if($echo) { $status = true; echo ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } else{ return ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } } if( wpforo_topic($item['topicid'], 'is_answer') ){ $icon['class'] = 'fa-check-circle'; $icon['color'] = 'wpfcl-8'; $icon['title'] = wpforo_phrase('Solved', false); if($echo) { $status = true; echo ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } else{ return ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } } } if( $item['closed'] && $item['type'] == 1 ){ $icon['class'] = 'fa-lock'; $icon['color'] = 'wpfcl-1'; $icon['title'] = wpforo_phrase('Closed', false); if($echo) { $status = true; echo ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } else{ return ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } } elseif( $item['closed'] && $item['type'] != 1 ){ $icon['class'] = 'fa-lock'; $icon['color'] = 'wpfcl-1'; $icon['title'] = wpforo_phrase('Closed', false); if($echo) { $status = true; echo ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } else{ return ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } } elseif( !$item['closed'] && $item['type'] == 1 ){ $icon['class'] = 'fa-thumb-tack'; $icon['color'] = 'wpfcl-5'; $icon['title'] = wpforo_phrase('Sticky', false); if($echo) { $status = true; echo ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } else{ return ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } } if( $status ){ //do nothing } else{ if( $type == 'forum' ){ $icon['class'] = 'fa-comments'; $icon['color'] = 'wpfcl-2'; } elseif( $type == 'topic' ){ if( $item['posts'] == 1 ){ $icon['class'] = 'fa-file-o'; $icon['color'] = 'wpfcl-2'; $icon['title'] = ''; } elseif( $item['posts'] > 1 && $item['posts'] <= 5 ){ $icon['class'] = 'fa-file-text-o'; $icon['color'] = 'wpfcl-2'; $icon['title'] = ''; } elseif( $item['posts'] > 5 && $item['posts'] <= 20 ){ $icon['class'] = 'fa-file-text'; $icon['color'] = 'wpfcl-2'; $icon['title'] = ''; } elseif( $item['posts'] > 20 ){ $icon['class'] = 'fa-file-text'; $icon['color'] = 'wpfcl-5'; $icon['title'] = ''; } else{ $icon['class'] = 'fa-file-o'; $icon['color'] = 'wpfcl-2'; $icon['title'] = ''; } } if($echo) { echo ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } else{ return ($data == 'icon') ? implode(' ', $icon) : $icon['title']; } } } else{ return false; } } public function member_buttons( $member ){ if(empty($member)) return false; $profile_access = ( $this->wpforo->perm->usergroup_can('vprf') ? true : false ); if( $profile_access ){ ?> wpforo->perm->usergroup_can('vmsn') ? true : false ); if( $social_access ){ if( isset($member['facebook']) && $member['facebook'] ){ $socnets['facebook']['set'] = $member['facebook']; $member['facebook'] = ( strpos($member['facebook'], 'facebook.com') === FALSE ) ? 'https://www.facebook.com/' . trim($member['facebook'], '/') : $member['facebook'] ; $socnets['facebook']['value'] = $member['facebook']; $socnets['facebook']['protocol'] = 'https://'; $socnets['facebook']['title'] = wpforo_phrase('Facebook', false); } if( isset($member['twitter']) && $member['twitter'] ){ $socnets['twitter']['set'] = $member['twitter']; $member['twitter'] = ( strpos($member['twitter'], 'twitter.com') === FALSE ) ? 'http://twitter.com/' . trim($member['twitter'], '/') : $member['twitter'] ; $socnets['twitter']['value'] = $member['twitter']; $socnets['twitter']['protocol'] = 'https://'; $socnets['twitter']['title'] = wpforo_phrase('Twitter', false); } if( isset($member['gtalk']) && $member['gtalk'] ){ $socnets['gtalk']['set'] = $member['gtalk']; $socnets['gtalk']['value'] = $member['gtalk']; $socnets['gtalk']['protocol'] = 'https://'; $socnets['gtalk']['title'] = wpforo_phrase('Google+', false); } if( isset($member['yahoo']) && $member['yahoo'] ){ $socnets['yahoo']['set'] = $member['yahoo']; $socnets['yahoo']['value'] = $member['yahoo']; $socnets['yahoo']['protocol'] = 'mailto:'; $socnets['yahoo']['title'] = wpforo_phrase('Yahoo', false); } if( isset($member['aim']) && $member['aim'] ){ $socnets['aim']['set'] = $member['aim']; $socnets['aim']['value'] = $member['aim']; $socnets['aim']['protocol'] = 'mailto:'; $socnets['aim']['title'] = wpforo_phrase('AOL IM', false); } if( isset($member['icq']) && $member['icq'] ){ $socnets['icq']['set'] = $member['icq']; $socnets['icq']['value'] = 'www.icq.com/whitepages/cmd.php?uin=' . $member['icq'] . '&action=message'; $socnets['icq']['protocol'] = 'https://'; $socnets['icq']['title'] = wpforo_phrase('ICQ', false); } if( isset($member['msn']) && $member['msn'] ){ $socnets['msn']['set'] = $member['msn']; $socnets['msn']['value'] = $member['msn']; $socnets['msn']['protocol'] = 'mailto:'; $socnets['msn']['title'] = wpforo_phrase('MSN', false); } if( isset($member['skype']) && $member['skype'] ){ $socnets['skype']['set'] = $member['skype']; $socnets['skype']['value'] = $member['skype']; $socnets['skype']['protocol'] = 'skype:'; $socnets['skype']['title'] = wpforo_phrase('Skype', false); } ?>
$socnet ): ?> <?php echo esc_attr($title) ?>
wpforo->member_tpls = array( 'account' => wpftpl('profile-account.php'), 'activity' => wpftpl('profile-activity.php'), 'subscriptions' => wpftpl('profile-subscriptions.php') ); $this->wpforo->member_tpls = apply_filters('wpforo_member_templates_filter', $this->wpforo->member_tpls); $this->wpforo->member_tpls['profile'] = wpftpl('profile-home.php'); } function has_menu(){ return has_nav_menu( 'wpforo-menu' ); } function nav_menu(){ if ( has_nav_menu( 'wpforo-menu' ) ){ $defaults = array( 'theme_location' => 'wpforo-menu', 'menu' => '', 'container' => '', 'container_class' => '', 'container_id' => '', 'menu_class' => 'wpf-menu', 'menu_id' => 'wpf-menu', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '', 'depth' => 0, 'walker' => '' ); wp_nav_menu( $defaults ); } } function init_nav_menu(){ if(isset($this->wpforo->current_object) && !empty($this->wpforo->current_object)){ extract($this->wpforo->current_object, EXTR_OVERWRITE); $this->wpforo->menu['wpforo-home'] = array( 'href' => wpforo_home_url(), 'label' => wpforo_phrase('forums', FALSE), 'attr' => ( $template == 'forum' || $template == 'topic' || $template == 'post' ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); if($this->wpforo->perm->usergroup_can('vmem')){ $this->wpforo->menu['wpforo-members'] = array( 'href' => wpforo_home_url('members'), 'label' => wpforo_phrase('members', FALSE), 'attr' => ( $template == 'members' ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); } if( is_user_logged_in() ){ $this->wpforo->menu['wpforo-profile-home'] = array( 'href' => $this->wpforo->member->get_profile_url($this->wpforo->current_userid), 'label' => wpforo_phrase('my profile', FALSE), 'attr' => ( isset($this->wpforo->member_tpls[$template]) && $this->wpforo->member_tpls[$template] && $this->wpforo->current_object['user_is_same_current_user'] ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); $this->wpforo->menu['wpforo-profile-account'] = array( 'href' => $this->wpforo->member->get_profile_url($this->wpforo->current_userid, 'account'), 'label' => wpforo_phrase('account', FALSE), 'attr' => ( $template == 'account' && $this->wpforo->current_object['user_is_same_current_user'] ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); $this->wpforo->menu['wpforo-profile-activity'] = array( 'href' => $this->wpforo->member->get_profile_url($this->wpforo->current_userid, 'activity'), 'label' => wpforo_phrase('activity', FALSE), 'attr' => ( $template == 'activity' && $this->wpforo->current_object['user_is_same_current_user'] ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); $this->wpforo->menu['wpforo-profile-subscriptions'] = array( 'href' => $this->wpforo->member->get_profile_url($this->wpforo->current_userid, 'subscriptions'), 'label' => wpforo_phrase('subscriptions', FALSE), 'attr' => ( $template == 'subscriptions' && $this->wpforo->current_object['user_is_same_current_user'] ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); $this->wpforo->menu['wpforo-logout'] = array( 'href' => wpforo_home_url('?wpforo=logout'), 'label' => wpforo_phrase('logout', FALSE), 'attr' => '', 'submenues' => array() ); }else{ if( wpforo_feature('user-register', $this->wpforo) ){ $this->wpforo->menu['wpforo-register'] = array( 'href' => wpforo_register_url(), 'label' => wpforo_phrase('register', FALSE), 'attr' => ( isset($_GET['wpforo']) && $_GET['wpforo'] == 'signup' ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); } $this->wpforo->menu['wpforo-login'] = array( 'href' => wpforo_login_url(), 'label' => wpforo_phrase('login', FALSE), 'attr' => ( isset($_GET['wpforo']) && $_GET['wpforo'] == 'signin' ? ' class="wpforo-active"' : '' ), 'submenues' => array() ); } $this->wpforo->menu = apply_filters('wpforo_menu_array_filter', $this->wpforo->menu); } } /** * * Checks in current active theme options if certain layout exists. * * @since 1.0.0 * * @param mixed $identifier Layout id (folder name) OR @layout variable in header ( 1 or Extended ) * @param string $identifier_type The type of first parameter 'id' OR 'name' (@layout) * * @return boolean true/false * **/ function layout_exists( $identifier, $identifier_type = 'id' ){ $layouts = $this->options['layouts']; if( $identifier_type == 'id' ){ if( isset($layouts[$identifier]) && !empty($layouts[$identifier])){ return true; } else{ return false; } } elseif( $identifier_type = 'name' ){ foreach( $layouts as $id => $layout ){ if( !isset($layout['name']) && $layout['name'] == $identifier ){ return true; } } return false; } } /** * * Finds and returns all layouts information in array from theme's /layouts/ folder * * @since 1.0.0 * * @param string $theme Theme id ( folder name ) e.g. 'classic' * * @return array * **/ function find_layouts( $theme ){ $layout_data = array(); $layouts = $this->find_themes('/'.$theme.'/layouts', 'php', 'layout'); if(!empty($layouts)){ foreach( $layouts as $layout ){ $lid = trim(basename(dirname( $layout['file']['value'] )), '/'); $layout_data[$lid]['id'] = $lid; $layout_data[$lid]['name'] = $layout['name']['value']; $layout_data[$lid]['version'] = $layout['version']['value']; $layout_data[$lid]['description'] = $layout['description']['value']; $layout_data[$lid]['author'] = $layout['author']['value']; $layout_data[$lid]['url'] = $layout['layout_url']['value']; $layout_data[$lid]['file'] = $layout['file']['value']; } } return $layout_data; } function show_layout_selectbox($layoutid = 0){ $layouts = $this->find_layouts( WPFORO_THEME ); if( !empty($layouts) ){ foreach( $layouts as $layout ) : ?> find_theme_headers( WPFORO_THEME_DIR . '/' . $theme_file ); $theme['id'] = $theme_folder; $theme['name'] = $theme_data['name']['value']; $theme['version'] = $theme_data['version']['value']; $theme['description'] = $theme_data['description']['value']; $theme['author'] = $theme_data['author']['value']; $theme['url'] = $theme_data['theme_url']['value']; $theme['file'] = $theme_file; $theme['folder'] = $theme_folder; $theme['layouts'] = $this->find_layouts( $theme_folder ); $styles = $this->find_styles( $theme_folder ); if(!empty($styles)){ reset($styles); $theme['style'] = key($styles); $theme['styles'] = $styles; } return $theme; } } /** * * Scans wpForo themes (wpf-themes) folder, reads main files' headers and returns information about all themes in array. * This function can also be used to scan and get information about layouts in each theme /layouts/ folder. * * @since 1.0.0 * * @param string $base_dir Absolute path to scan directory (e.g. /home/public_html/wp-content/plugins/wpforo/wpf-themes/) * @param string $ext File extension which may contain header information * @param string $mode 'theme' or 'layout' * * @return array * **/ function find_themes( $base_dir = '', $ext = 'css', $mode = 'theme' ){ $themes = array (); $themes_dir = @opendir( WPFORO_THEME_DIR . $base_dir ); $theme_files = array(); if( $themes_dir ){ while( ($file = readdir( $themes_dir )) !== false ){ if( substr($file, 0, 1) == '.' ) continue; if( is_dir( WPFORO_THEME_DIR . $base_dir .'/'.$file ) ){ $themes_subdir = @opendir( WPFORO_THEME_DIR . $base_dir .'/'.$file ); if( $themes_subdir ){ while(($subfile = readdir( $themes_subdir ) ) !== false ){ if( substr($subfile, 0, 1) == '.' ) continue; if( substr($subfile, -4) == '.' . $ext ) $theme_files[] = "$file/$subfile"; } closedir( $themes_subdir ); } } else{ if( substr($file, -4) == '.' . $ext ) $theme_files[] = $file; } } closedir( $themes_dir ); } if( empty($theme_files) ) return $themes; foreach( $theme_files as $theme_file ){ if( !is_readable( WPFORO_THEME_DIR . $base_dir . '/' . $theme_file ) ) continue; if( $mode == 'theme' ){ $theme_data = $this->find_theme_headers( WPFORO_THEME_DIR . $base_dir . '/' . $theme_file ); } elseif( $mode == 'layout' ){ $theme_data = $this->find_layout_headers( WPFORO_THEME_DIR . $base_dir . '/' . $theme_file ); } if( empty($theme_data['name']['value']) ) continue; $themes[wpforo_clear_basename($theme_file)] = $theme_data; } return $themes; } /** * * Reads theme main file's header variables and returns information in array. * * @since 1.0.0 * * @param string $file Absolute path to file (e.g. /home/public_html/wp-content/plugins/wpforo/wpf-themes/style.css) * * @return array * **/ function find_theme_headers( $file ){ $theme_headers = array(); $headers = array( 'name' => 'Theme Name', 'version' => 'Version', 'description' => 'Description', 'author' => 'Author', 'theme_url' => 'Theme URI', ); $fp = fopen( $file, 'r' ); $data = fread( $fp, 8192 ); fclose( $fp ); $data = str_replace( "\r", "\n", $data ); foreach ( $headers as $header_key => $header_name ){ if ( preg_match( '|^[\s\t\/*#@]*' . preg_quote( $header_name, '|' ) . ':(.*)$|mi', $data, $match ) && $match[1] ){ $theme_headers[$header_key]['name'] = $header_name; $theme_headers[$header_key]['value'] = trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $match[1])); } else{ $theme_headers[$header_key]['name'] = $header_name; $theme_headers[$header_key]['value'] = ''; } } $theme_headers['file']['name'] = 'file'; $theme_headers['file']['value'] = $file; return $theme_headers; } /** * * Reads layout main file's header variables and returns information in array. * * @since 1.0.0 * * @param string $file Absolute path to file (e.g. /home/public_html/wp-content/plugins/wpforo/wpf-themes/layouts/1/forum.php) * * @return array * **/ function find_layout_headers( $file ){ $theme_headers = array(); $headers = array( 'name' => 'layout', 'version' => 'version', 'description' => 'description', 'author' => 'author', 'layout_url' => 'url', ); $fp = fopen( $file, 'r' ); $data = fread( $fp, 8192 ); fclose( $fp ); $data = str_replace( "\r", "\n", $data ); foreach ( $headers as $header_key => $header_name ){ if ( preg_match( '|^[\s\t\/*#@]*' . preg_quote( $header_name, '|' ) . ':(.*)$|mi', $data, $match ) && $match[1] ){ $theme_headers[$header_key]['name'] = $header_name; $theme_headers[$header_key]['value'] = trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $match[1])); } else{ $theme_headers[$header_key]['name'] = $header_name; $theme_headers[$header_key]['value'] = ''; } } $theme_headers['file']['name'] = 'file'; $theme_headers['file']['value'] = trim(str_replace( WPFORO_THEME_DIR, '', $file), '/'); return $theme_headers; } public function copyright(){ if( wpforo_feature('copyright', $this->wpforo) ): ?>

Powered by wpForo   wpForo version

'fa-user', 'account' => 'fa-cog', 'activity' => 'fa-comments-o', 'subscriptions' => 'fa-rss'); $menu = apply_filters('wpforo_member_menu_filter', $menu, $userid); if( !($userid == $this->wpforo->current_userid || $this->wpforo->perm->usergroup_can('em')) ) unset($menu['account']); foreach( $menu as $key => $value ) : ?> wpforo->current_object, EXTR_OVERWRITE); extract($user, EXTR_OVERWRITE); include( (isset($this->wpforo->member_tpls[$template]) && $this->wpforo->member_tpls[$template] ? $this->wpforo->member_tpls[$template] : $this->wpforo->member_tpls['profile']) ); } public function member_error(){ echo apply_filters('wpforo_member_error_filter', wpforo_phrase('Members not found', FALSE)); } public function field( $args, $wrap = true ){ $default = array( 'label' => '', 'title' => '', 'name' => '', 'value' => '', //url 'values' => '', 'type' => 'text', 'placeholder' => '', 'description' => '', 'id' => '', 'class' => '', 'attributes' => '', 'isWrapItem' => '', 'isLabelFirst' => '', 'isDisabled' => false, 'isEditable' => 1, 'isRequired' => 1, 'isMultiChoice' => 0, 'isConfirmPassword' => 1, 'minLength' => 0, 'maxLength' => 0, 'faIcon' => '', 'html' => '', 'varname' => (( isset($this->wpforo->form['varname']) ) ? $this->wpforo->form['varname'] : 'wpfdata'), 'template' => (( isset($this->wpforo->form['template']) ) ? $this->wpforo->form['template'] : $this->wpforo->current_object['template']), 'canBeInactive' => 1, 'canEdit' => array('1'), 'canView' => array('1', '2', '3', '5'), 'can' => '' ); $args = wpforo_parse_args( $args, $default ); extract( $args ); $field_html = ''; $minLength_attr = ''; $maxLength_attr = ''; $isRequired = ( $isRequired ) ? ' required="required" ' : ''; $isDisabled = ( $isDisabled ) ? ' disabled="disabled" ' : ''; $isDisabled = ( !$isEditable && $template != 'register' && $name != 'user_login') ? ' disabled="disabled" style="display:none" ' : ''; if( !$isDefault ){ $varname = 'data'; } $fieldName = ( !empty($varname) ? $varname . '[' . $name . ']' : $name ); $fieldId = ( !empty($varname) ? $varname . '_' : '' ) . ( ($id) ? $id : $name ); $minLength = ($minLength) ? intval($minLength): ''; $maxLength = ($maxLength) ? intval($maxLength): ''; if( $minLength ) { $minLength_attr = ($type == 'date' || $type == 'number' || $type == 'range') ? ' min="' . $minLength . '" ' : ' minlength="' . $minLength . '" '; } if( $maxLength ) { $maxLength_attr = ($type == 'date' || $type == 'number' || $type == 'range') ? ' max="' . $maxLength . '" ' : ' maxlength="' . $maxLength . '" '; } $minmax = $minLength_attr . ' ' . $maxLength_attr; $args['value'] = ( isset($this->wpforo->form['value'][$name]) ) ? $this->wpforo->form['value'][$name] : $args['value']; if( !$isDefault && $varname ) $args['value'] = ( isset($this->wpforo->form['value'][$varname][$name]) ) ? $this->wpforo->form['value'][$varname][$name] : $args['value']; $value = $args['value']; if( $type == 'textarea' ){ $field_html = ''; } elseif( $type == 'password' ){ $password_html = ''; if( $template == 'account' ){ $isRequired = 0; $args['label'] = wpforo_phrase('Old password', false); $args['description'] = ''; $password_html = ''; $field_html .= ( $wrap ) ? $this->field_wrap( $args, $password_html ) : $password_html; } if( $template == 'register' && wpforo_feature('user-register-email-confirm') ){ //If the option "User Registration with Email Confirmation" is enabled password fields should be removed on registration page. } else{ if( $isConfirmPassword ) { $p1 = '1'; $p2 = '2'; } else{ $p1 = ''; $p2 = ''; } $fieldName = ( !empty($varname) ? $varname . '[' . $name . $p1 . ']' : $name . $p1 ); if( $template == 'account' ) { $label = wpforo_phrase('New', false) . ' ' . $label; } $args['label'] = $label; $args['description'] = $description; $password_html = ''; $field_html .= ( $wrap ) ? $this->field_wrap( $args, $password_html ) : $password_html; if( $isConfirmPassword ){ $args['label'] = wpforo_phrase('Confirm Password', false); $args['description'] = ''; $fieldName = ( !empty($varname) ? $varname . '[' . $name . $p2 . ']' : $name . $p2 ); $password_html = ''; $field_html .= ( $wrap ) ? $this->field_wrap( $args, $password_html ) : $password_html; } } } elseif( $type == 'file' ){ $extensions = ''; if( $fileExtensions ) { $fileExtensions = wpforo_parse_args($fileExtensions); foreach($fileExtensions as $key => $ext ){ if( strpos($ext, '.') === FALSE ) $fileExtensions[ $key ] = '.' . $ext; } $fileExtensions = implode(', ', $fileExtensions); if( $fileExtensions ) $extensions = 'accept="' .$fileExtensions . '"'; } $field_html = ''; } elseif( $type == 'checkbox' ){ $step = 0; $field_html = ''; $value = (is_serialized($value)) ? unserialize($value) : (array)$value; if( !is_array($values) ) $values = wpforo_string2array($values); if( !empty($values) ){ foreach( $values as $v ){ $v = trim($v); $data = explode('=>', $v); $item_value = isset($data[0]) ? $data[0] : 'no_value'; $item_label = isset($data[1]) ? $data[1] : $item_value; $item_fieldid = $fieldId . '_' . ($step + 1); $item_fieldname = $fieldName . '[]'; $checked = ( in_array($item_value, $value) ) ? 'checked="checked"' : ''; $field_html .= '
'; $input_html = ''; if ($isWrapItem) { $field_html .= ''; } else { if ($isLabelFirst) { $field_html .= '' . stripslashes($item_label) . ' ' . $input_html; } else { $field_html .= $input_html . ' ' . stripslashes($item_label) . ''; } } $field_html .= '
'; $step++; } } } elseif( $type == 'radio' ){ $step = 0; $field_html = ''; if (!is_array($values)) $values = wpforo_string2array($values); if (!empty($values)) { $item_values = array(); foreach ($values as $v) { $v = trim($v); $data = explode('=>', $v); $item_value = $data[0]; $item_label = isset($data[1]) ? $data[1] : $item_value; $item_fieldid = $fieldId . '_' . ($step + 1); $attrs = ($isRequired) ? 'required="required"' : ''; $attrs .= ($item_value == $value) ? ' checked="checked"' : ''; $field_html .= '
'; $input_html = ''; if ($isWrapItem) { $field_html .= ''; } else { if ($isLabelFirst) { $field_html .= '' . stripslashes($item_label) . ' ' . $input_html; } else { $field_html .= $input_html . ' ' . stripslashes($item_label) . ''; } } $field_html .= '
'; $step++; } } } elseif( $type == 'select' ){ $isMultiChoice = $isMultiChoice ? 'multiple="multiple"' : ''; $field_html = ''; } elseif ($type == 'usergroup') { $groupids = array(); if ($allowedGroupIds) { if (!is_array($allowedGroupIds)) $allowedGroupIds = explode(',', trim($allowedGroupIds)); $groupids = $allowedGroupIds; } if ( !$this->wpforo->current_object['user_is_same_current_user'] && ($this->wpforo->current_user_groupid == 1 || current_user_can('administrator') ) ) $groupids = $this->wpforo->usergroup->get_usergroups('groupid'); if( $this->wpforo->current_object['user_is_same_current_user'] && !in_array($this->wpforo->current_user_groupid, $allowedGroupIds) ) $groupids = array(); $groupids = array_filter($groupids); if( $groupids ){ $field_html = ''; } } elseif( $type == 'avatar' ){ $field_html = ' '; } elseif( $type == 'html' ){ $field_html = stripslashes($html); } else{ $field_html = ''; } if( $wrap && $type != 'password' && $field_html ) $field_html = $this->field_wrap( $args, $field_html ); return $field_html; } public function field_wrap( $args, $field_html ){ if( !is_array($args) || empty($args) ) return $field_html; extract( $args ); $field_wrap_html = ''; $is_owner = false; $rIcon = ''; if( isset($this->wpforo->current_object['user']['ID']) ) { $is_owner = wpforo_is_owner( $this->wpforo->current_object['user']['ID'] ); } $field_name_class = sanitize_text_field($name); if( $isRequired ) $rIcon = ' *'; $field_required_class = ( $isRequired ) ? 'wpf-field-required' : ''; if( $template == 'register' ){ $field_wrap_html .= '
'; if( $type == 'html' ){ $field_wrap_html .= $field_html; } else{ if ( $label || $description ) { $field_wrap_html .= '
'; if ($label){ $field_wrap_html .= '

' . stripslashes($label) . $rIcon . '

'; } if ($description){ $field_wrap_html .= '
' . $description . '
'; } $field_wrap_html .= '
'; } $field_wrap_html .= '
'; if($faIcon){ $field_wrap_html .= ''; } $field_wrap_html .= $field_html; $field_wrap_html .= '
'; } $field_wrap_html .= '
'; } elseif( $template == 'account' ){ //if( !$isEditable && !$value ) return; if( isset($this->wpforo->current_user_groupid) && isset($canEdit) && !empty($canEdit) ){ $canEdit = ( is_array($canEdit) ) ? $canEdit : array(1); if( !$is_owner && !in_array( $this->wpforo->current_user_groupid, $canEdit )) return; if( $type == 'usergroup' && (!$this->wpforo->current_user_groupid == 1 || !current_user_can('administrator'))) return; if( $type == 'avatar' && (!$this->wpforo->perm->usergroup_can('va') || !wpforo_feature('custom-avatars') || !wpforo_feature('avatars'))) return; if( $name == 'signature' && (!$this->wpforo->perm->usergroup_can('ups') || !wpforo_feature('signature'))) return; if( $name == 'user_login' ){ $description = ''; $faIcon = ''; $field_html = '' . $value . ''; } if( !$isEditable && $name != 'user_login' ){ $description = ''; $field_html = ' ' . $value . '' . $field_html; $faIcon = ''; } } $field_wrap_html .= '
'; if( $type == 'html' ){ $field_wrap_html .= $field_html; } else{ if ( $label || $description ) { $field_wrap_html .= '
'; if ($label){ $field_wrap_html .= '

' . stripslashes($label) . $rIcon . '

'; } if ($description){ $field_wrap_html .= '
' . $description . '
'; } $field_wrap_html .= '
'; } $field_wrap_html .= '
'; if($faIcon){ $field_wrap_html .= ''; } $field_wrap_html .= $field_html; switch ($type){ case 'file': if( !empty($value) ) { $wp_upload_dir = wp_upload_dir(); $value = $wp_upload_dir['baseurl'] . "/" . trim($value, '/'); $field_wrap_html .= '
' . sprintf('%s', $value, basename($value)); } break; } $field_wrap_html .= '
'; } $field_wrap_html .= '
'; } elseif( $template == 'profile' ){ if( !isset($value) || empty($value) || !$value ){ return; } if( $type == 'textarea' ) $value = wpautop(wpforo_kses(stripslashes($value))); $field_wrap_html .= '
'; if( $type == 'html' ){ $field_wrap_html .= $field_html; } else{ if( !$faIcon ) { $faIcon .= 'fa-address-card'; } if( $label ) { $field_wrap_html .= '
'; if ($label){ $field_wrap_html .= '

' . stripslashes($label) . '

'; } $field_wrap_html .= '
';} if( $faIcon ) { $field_wrap_html .= ''; } if( isset($value) && !empty($value) ){ if( is_array($value) ){ $field_wrap_html .= esc_html(implode( ', ', $value)); } else{ switch ($args['type']){ case 'url': $value = sprintf('%s', $value, $value); break; case 'email': $value = sprintf('%s', $value, $value); break; case 'phone': $value = sprintf('%s', $value, $value); break; case 'file': if( !empty($value) ){ $wp_upload_dir = wp_upload_dir(); $value = $wp_upload_dir['baseurl'] . "/" . trim($value, '/'); $value = sprintf('%s', $value, basename($value)); } break; } switch ($args['name']){ case 'skype': $value = sprintf('%s', $value, $value); break; case 'location': $value = sprintf('%s', $value, $value); break; } $field_wrap_html .= '
'; $field_wrap_html .= $value; $field_wrap_html .= '
'; } } } $field_wrap_html .= '
'; } elseif( $template == 'members' ){ $field_wrap_html .= '
'; if( $type == 'html' ){ $field_wrap_html .= $field_html; } else{ if ( $label || $description ) { $field_wrap_html .= '
'; if ($label){ $field_wrap_html .= '

' . stripslashes($label) . $rIcon . '

'; } if ($description){ $field_wrap_html .= '
' . $description . '
'; } $field_wrap_html .= '
'; } $field_wrap_html .= '
'; if($faIcon){ $field_wrap_html .= ''; } $field_wrap_html .= $field_html; $field_wrap_html .= '
'; } $field_wrap_html .= '
'; } else{ $field_wrap_html .= '
'; $field_wrap_html .= '
' . $field_html . '
'; $field_wrap_html .= '
'; } return $field_wrap_html; } public function form_fields( $fields ){ if(empty($fields)) return ''; $rows = $fields; $html = ''; $rowClasses = ''; $colClasses = ''; for ($i = 0; $i < count($rows); $i++) { if( !isset($rows[$i])) continue; $row = $rows[$i]; $rowClasses .= "row-$i "; $rowClasses .= apply_filters('wpforo_row_classes', '', $i); ///////////////////////// ROW START ///////////////////////////////////// $html .= '
'; $cell_count = count($row); for ($j = 0; $j < $cell_count; $j++) { if( !isset($row[$j])) continue; $col = $row[$j]; $colClasses = "row_$i-col_$j "; $colClasses .= apply_filters('wpforo_col_classes', '', $i, $j); ///////////////////////// COL START ///////////////////////////////// $html .= '
'; for ($k = 0; $k < count($col); $k++) { ///////////////////////// FIELD START /////////////////////////// $field = $col[$k]; if( !empty($field) ) { $html .= $this->field( $field ); } ///////////////////////// FIELD END ///////////////////////////// } $html .= '
'; ///////////////////////// COL END /////////////////////////////////// } $html .= '
'; ///////////////////////// ROW END //////////////////////////////////////// } return $html; } }