PluginProbe
wpForo Forum / 1.1.0
wpForo Forum v1.1.0
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
wpforo / wpf-themes / classic / functions.php

functions.php in wpForo Forum 1.1.0, at wpf-themes/classic/functions.php

138 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5 /**
6 * wpForo Classic Theme Functions
7 * @hook: action - 'init'
8 * @description: only for wpForo theme functions. For WordPress theme functions use functions-wp.php file.
9 * @theme: Classic
10 */
11
12 function wpforo_classic_wpforo_frontend_enqueue(){
13 global $wpforo;
14 if(function_exists('is_wpforo_page')){
15 if(is_wpforo_page()){
16 wp_register_style( 'wpforo-uidialog-style', WPFORO_URL . '/wpf-assets/css/jquery-ui.css', false, WPFORO_VERSION );
17 wp_enqueue_style('wpforo-uidialog-style');
18 }
19 }
20 elseif ( !is_front_page() && !is_home() ) {
21 wp_register_style( 'wpforo-uidialog-style', WPFORO_URL . '/wpf-assets/css/jquery-ui.css', false, WPFORO_VERSION );
22 wp_enqueue_style('wpforo-uidialog-style');
23 }
24 }
25 add_action('wp_enqueue_scripts', 'wpforo_classic_wpforo_frontend_enqueue');
26
27 function wpforo_classic_forum_options($wpforo){
28 ?>
29 <?php if($wpforo->tpl->layout_exists(1)): ?>
30 <?php
31 if(!isset($wpforo->forum_options['layout_extended_intro_topics_toggle'])) $wpforo->forum_options['layout_extended_intro_topics_toggle'] = 1;
32 if(!isset($wpforo->forum_options['layout_extended_intro_topics_count'])) $wpforo->forum_options['layout_extended_intro_topics_count'] = 3;
33 ?>
34 <tr>
35 <th><label><?php _e('Extended Layout - Intro topics','wpforo'); ?>:</label></th>
36 <td>
37 <div class="wpf-switch-field">
38 <input id="show-tte" type="radio" name="wpforo_forum_options[layout_extended_intro_topics_toggle]" value="1" <?php wpfo_check($wpforo->forum_options['layout_extended_intro_topics_toggle'], 1); ?>/><label for="show-tte"><?php _e('Expanded','wpforo'); ?></label> &nbsp;
39 <input id="hide-tte" type="radio" name="wpforo_forum_options[layout_extended_intro_topics_toggle]" value="0" <?php wpfo_check($wpforo->forum_options['layout_extended_intro_topics_toggle'], 0); ?>/><label for="hide-tte"><?php _e('Collapsed','wpforo'); ?></label>
40 </div>
41 </td>
42 </tr>
43 <tr>
44 <th><label for="tdcs"><?php _e('Extended Layout - Number of intro topics','wpforo'); ?>:</label></th>
45 <td>
46 <input id="tdcs" name="wpforo_forum_options[layout_extended_intro_topics_count]" type="number" min="0" value="<?php wpfo( $wpforo->forum_options['layout_extended_intro_topics_count'] ) ?>" class="wpf-field-small" />
47 </td>
48 </tr>
49 <?php endif; ?>
50 <?php if($wpforo->tpl->layout_exists(3)): ?>
51 <?php
52 if(!isset($wpforo->forum_options['layout_qa_intro_topics_toggle'])) $wpforo->forum_options['layout_qa_intro_topics_toggle'] = 1;
53 if(!isset($wpforo->forum_options['layout_qa_intro_topics_count'])) $wpforo->forum_options['layout_qa_intro_topics_count'] = 3;
54 ?>
55 <tr>
56 <th><label><?php _e('Q&A layout - Intro topics','wpforo'); ?>:</label></th>
57 <td>
58 <div class="wpf-switch-field">
59 <input id="show-ttq" type="radio" name="wpforo_forum_options[layout_qa_intro_topics_toggle]" value="1" <?php wpfo_check($wpforo->forum_options['layout_qa_intro_topics_toggle'], 1); ?>/><label for="show-ttq"><?php _e('Expanded','wpforo'); ?></label> &nbsp;
60 <input id="hide-ttq" type="radio" name="wpforo_forum_options[layout_qa_intro_topics_toggle]" value="0" <?php wpfo_check($wpforo->forum_options['layout_qa_intro_topics_toggle'], 0); ?>/><label for="hide-ttq"><?php _e('Collapsed','wpforo'); ?></label>
61 </div>
62 </td>
63 </tr>
64 <tr>
65 <th><label for="tdcq"><?php _e('Q&A Layout - Number of intro topics','wpforo'); ?>:</label></th>
66 <td>
67 <input id="tdcq" name="wpforo_forum_options[layout_qa_intro_topics_count]" type="number" min="0" value="<?php wpfo( $wpforo->forum_options['layout_qa_intro_topics_count'] ) ?>" class="wpf-field-small" />
68 </td>
69 </tr>
70 <?php endif; ?>
71 <?php
72 }
73 add_action('wpforo_settings_forums', 'wpforo_classic_forum_options');
74
75
76
77 function wpforo_classic_post_options($wpforo){
78 ?>
79 <?php if($wpforo->tpl->layout_exists(1)): ?>
80 <?php
81 if(!isset($wpforo->post_options['layout_extended_intro_posts_toggle'])) $wpforo->post_options['layout_extended_intro_posts_toggle'] = 1;
82 if(!isset($wpforo->post_options['layout_extended_intro_posts_count'])) $wpforo->post_options['layout_extended_intro_posts_count'] = 4;
83 ?>
84 <tr>
85 <th><label><?php _e('Extended Layout - Intro posts','wpforo'); ?></label></th>
86 <td>
87 <div class="wpf-switch-field">
88 <input id="show-tte" type="radio" name="wpforo_post_options[layout_extended_intro_posts_toggle]" value="1" <?php wpfo_check($wpforo->post_options['layout_extended_intro_posts_toggle'], 1); ?>/><label for="show-tte"><?php _e('Expanded','wpforo'); ?></label> &nbsp;
89 <input id="hide-tte" type="radio" name="wpforo_post_options[layout_extended_intro_posts_toggle]" value="0" <?php wpfo_check($wpforo->post_options['layout_extended_intro_posts_toggle'], 0); ?>/><label for="hide-tte"><?php _e('Collapsed','wpforo'); ?></label>
90 </div>
91 </td>
92 </tr>
93 <tr>
94 <th>
95 <label for="tdcs"><?php _e('Extended Layout - Number of intro posts','wpforo'); ?></label>
96 <p class="wpf-info"><?php _e('Set this option value 0 if you want to show all posts under topic intro area.','wpforo'); ?></p>
97 </th>
98 <td>
99 <input id="tdcs" name="wpforo_post_options[layout_extended_intro_posts_count]" type="number" min="0" value="<?php wpfo( $wpforo->post_options['layout_extended_intro_posts_count'] ) ?>" class="wpf-field-small" />
100 </td>
101 </tr>
102 <?php endif; ?>
103 <?php
104 }
105 add_action('wpforo_settings_post_top', 'wpforo_classic_post_options');
106
107
108
109 function wpforo_classic_reply_form_head($string, $args){
110 global $wpforo;
111 if( $wpforo->tpl->layout_exists(3) ){
112 if( $args['layout'] == 3 ){
113 $string = preg_replace('|(<p[^><]*id="wpf-reply-form-title"[^><]*>)(.+?)(</p>)|is', '$1'.wpforo_phrase('Your Answer', false, 'default').'$3', $string);
114 }
115 }
116 return $string;
117 }
118 add_filter('wpforo_reply_form_head', 'wpforo_classic_reply_form_head', 1, 2);
119
120
121
122 function wpforo_classic_reply_form_field_title($string, $args){
123 global $wpforo;
124 if( $wpforo->tpl->layout_exists(3) ){
125 if( $args['layout'] == 3 ){
126 $string = preg_replace('|[^\:]+\:|is', wpforo_phrase('Answer to', false, 'default') . ':', $string);
127 }
128 }
129 return $string;
130 }
131 add_filter('wpforo_reply_form_field_title', 'wpforo_classic_reply_form_field_title', 1, 2);
132
133 function wpforo_classic_dark_class( $wpforo ){
134 if(empty($wpforo)) return;
135 if(isset($wpforo->theme_options['style'])) echo 'wpf-' . esc_attr($wpforo->theme_options['style']);
136 }
137
138 add_action('wpforo_wrap_class', 'wpforo_classic_dark_class');