PluginProbe
wpForo Forum / 1.4.12
wpForo Forum v1.4.12
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.4.12, at wpf-themes/classic/functions.php

166 lines 8.8 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 if(function_exists('is_wpforo_page')){
14 if(is_wpforo_page()){
15 wp_register_style( 'wpforo-uidialog-style', WPFORO_URL . '/wpf-assets/css/jquery-ui.css', false, WPFORO_VERSION );
16 wp_enqueue_style('wpforo-uidialog-style');
17
18 if( file_exists(WPFORO_TEMPLATE_DIR . '/colors.css') ){
19 wp_register_style( 'wpforo-dynamic-style', WPFORO_TEMPLATE_URL . '/colors.css', false, WPFORO_VERSION );
20 wp_enqueue_style('wpforo-dynamic-style');
21 }
22 }
23 }
24 elseif ( !is_front_page() && !is_home() ) {
25 wp_register_style( 'wpforo-uidialog-style', WPFORO_URL . '/wpf-assets/css/jquery-ui.css', false, WPFORO_VERSION );
26 wp_enqueue_style('wpforo-uidialog-style');
27 }
28 }
29 add_action('wp_enqueue_scripts', 'wpforo_classic_wpforo_frontend_enqueue', 11);
30
31 function wpforo_classic_forum_options(){
32 ?>
33 <?php if(WPF()->tpl->layout_exists(1)): ?>
34 <?php
35 if(!isset(WPF()->forum->options['layout_extended_intro_topics_toggle'])) WPF()->forum->options['layout_extended_intro_topics_toggle'] = 1;
36 if(!isset(WPF()->forum->options['layout_extended_intro_topics_count'])) WPF()->forum->options['layout_extended_intro_topics_count'] = 3;
37 ?>
38 <tr>
39 <th><label><?php _e('Extended Layout - Recent topics','wpforo'); ?>:</label></th>
40 <td>
41 <div class="wpf-switch-field">
42 <input id="show-tte" type="radio" name="wpforo_forum_options[layout_extended_intro_topics_toggle]" value="1" <?php wpfo_check(WPF()->forum->options['layout_extended_intro_topics_toggle'], 1); ?>/><label for="show-tte"><?php _e('Expanded','wpforo'); ?></label> &nbsp;
43 <input id="hide-tte" type="radio" name="wpforo_forum_options[layout_extended_intro_topics_toggle]" value="0" <?php wpfo_check(WPF()->forum->options['layout_extended_intro_topics_toggle'], 0); ?>/><label for="hide-tte"><?php _e('Collapsed','wpforo'); ?></label>
44 </div>
45 </td>
46 </tr>
47 <tr>
48 <th><label for="tdcs"><?php _e('Extended Layout - Number of Recent topics','wpforo'); ?>:</label></th>
49 <td>
50 <input id="tdcs" name="wpforo_forum_options[layout_extended_intro_topics_count]" type="number" min="0" value="<?php wpfo( WPF()->forum->options['layout_extended_intro_topics_count'] ) ?>" class="wpf-field-small" />
51 </td>
52 </tr>
53 <tr>
54 <th>
55 <label for="tdcs"><?php _e('Extended Layout - Recent topic length','wpforo'); ?>:</label>
56 <p class="wpf-info"><?php _e('Set this option value 0 if you want to show the whole title in recent topic area.','wpforo'); ?></p>
57 </th>
58 <td>
59 <input id="tdcs" name="wpforo_forum_options[layout_extended_intro_topics_length]" type="number" min="0" value="<?php wpfo( WPF()->forum->options['layout_extended_intro_topics_length'] ) ?>" class="wpf-field-small" />
60 </td>
61 </tr>
62 <?php endif; ?>
63 <?php if(WPF()->tpl->layout_exists(3)): ?>
64 <?php
65 if(!isset(WPF()->forum->options['layout_qa_intro_topics_toggle'])) WPF()->forum->options['layout_qa_intro_topics_toggle'] = 1;
66 if(!isset(WPF()->forum->options['layout_qa_intro_topics_count'])) WPF()->forum->options['layout_qa_intro_topics_count'] = 3;
67 ?>
68 <tr>
69 <th><label><?php _e('Q&A layout - Recent topics','wpforo'); ?>:</label></th>
70 <td>
71 <div class="wpf-switch-field">
72 <input id="show-ttq" type="radio" name="wpforo_forum_options[layout_qa_intro_topics_toggle]" value="1" <?php wpfo_check(WPF()->forum->options['layout_qa_intro_topics_toggle'], 1); ?>/><label for="show-ttq"><?php _e('Expanded','wpforo'); ?></label> &nbsp;
73 <input id="hide-ttq" type="radio" name="wpforo_forum_options[layout_qa_intro_topics_toggle]" value="0" <?php wpfo_check(WPF()->forum->options['layout_qa_intro_topics_toggle'], 0); ?>/><label for="hide-ttq"><?php _e('Collapsed','wpforo'); ?></label>
74 </div>
75 </td>
76 </tr>
77 <tr>
78 <th><label for="tdcq"><?php _e('Q&A Layout - Number of Recent topics','wpforo'); ?>:</label></th>
79 <td>
80 <input id="tdcq" name="wpforo_forum_options[layout_qa_intro_topics_count]" type="number" min="0" value="<?php wpfo( WPF()->forum->options['layout_qa_intro_topics_count'] ) ?>" class="wpf-field-small" />
81 </td>
82 </tr>
83 <tr>
84 <th>
85 <label for="tdcq"><?php _e('Q&A Layout - Recent topic length','wpforo'); ?>:</label>
86 <p class="wpf-info"><?php _e('Set this option value 0 if you want to show the whole title in recent topic area.','wpforo'); ?></p>
87 </th>
88 <td>
89 <input id="tdcq" name="wpforo_forum_options[layout_qa_intro_topics_length]" type="number" min="0" value="<?php wpfo( WPF()->forum->options['layout_qa_intro_topics_length'] ) ?>" class="wpf-field-small" />
90 </td>
91 </tr>
92 <?php endif; ?>
93 <?php
94 }
95 add_action('wpforo_settings_forums', 'wpforo_classic_forum_options');
96
97
98
99 function wpforo_classic_post_options(){
100 ?>
101 <?php if(WPF()->tpl->layout_exists(1)): ?>
102 <?php
103 if(!isset(WPF()->post->options['layout_extended_intro_posts_toggle'])) WPF()->post->options['layout_extended_intro_posts_toggle'] = 1;
104 if(!isset(WPF()->post->options['layout_extended_intro_posts_count'])) WPF()->post->options['layout_extended_intro_posts_count'] = 4;
105 ?>
106 <tr>
107 <th><label><?php _e('Extended Layout - Recent posts','wpforo'); ?></label></th>
108 <td>
109 <div class="wpf-switch-field">
110 <input id="show-tte" type="radio" name="wpforo_post_options[layout_extended_intro_posts_toggle]" value="1" <?php wpfo_check(WPF()->post->options['layout_extended_intro_posts_toggle'], 1); ?>/><label for="show-tte"><?php _e('Expanded','wpforo'); ?></label> &nbsp;
111 <input id="hide-tte" type="radio" name="wpforo_post_options[layout_extended_intro_posts_toggle]" value="0" <?php wpfo_check(WPF()->post->options['layout_extended_intro_posts_toggle'], 0); ?>/><label for="hide-tte"><?php _e('Collapsed','wpforo'); ?></label>
112 </div>
113 </td>
114 </tr>
115 <tr>
116 <th>
117 <label for="tdcs"><?php _e('Extended Layout - Number of Recent posts','wpforo'); ?></label>
118 <p class="wpf-info"><?php _e('Set this option value 0 if you want to show all posts in recent posts area.','wpforo'); ?></p>
119 </th>
120 <td>
121 <input id="tdcs" name="wpforo_post_options[layout_extended_intro_posts_count]" type="number" min="0" value="<?php wpfo( WPF()->post->options['layout_extended_intro_posts_count'] ) ?>" class="wpf-field-small" />
122 </td>
123 </tr>
124 <tr>
125 <th>
126 <label for="tdcs"><?php _e('Extended Layout - Recent post length','wpforo'); ?></label>
127 <p class="wpf-info"><?php _e('Set this option value 0 if you want to show the whole post content in recent post area.','wpforo'); ?></p>
128 </th>
129 <td>
130 <input id="tdcs" name="wpforo_post_options[layout_extended_intro_posts_length]" type="number" min="0" value="<?php wpfo( WPF()->post->options['layout_extended_intro_posts_length'] ) ?>" class="wpf-field-small" />
131 </td>
132 </tr>
133 <?php endif; ?>
134 <?php
135 }
136 add_action('wpforo_settings_post_top', 'wpforo_classic_post_options');
137
138
139
140 function wpforo_classic_reply_form_head($string, $args){
141 if( WPF()->tpl->layout_exists(3) ){
142 if( $args['layout'] == 3 ){
143 $string = preg_replace('|(<p[^><]*id="wpf-reply-form-title"[^><]*>)(.+?)(</p>)|is', '$1'.wpforo_phrase('Your Answer', false, 'default').'$3', $string);
144 }
145 }
146 return $string;
147 }
148 add_filter('wpforo_reply_form_head', 'wpforo_classic_reply_form_head', 1, 2);
149
150
151
152 function wpforo_classic_reply_form_field_title($string, $args){
153 if( WPF()->tpl->layout_exists(3) ){
154 if( $args['layout'] == 3 ){
155 $string = preg_replace('|[^\:]+\:|is', wpforo_phrase('Answer to', false, 'default') . ':', $string);
156 }
157 }
158 return $string;
159 }
160 add_filter('wpforo_reply_form_field_title', 'wpforo_classic_reply_form_field_title', 1, 2);
161
162 function wpforo_classic_dark_class(){
163 if(isset(WPF()->tpl->options['style'])) echo 'wpf-' . esc_attr(WPF()->tpl->options['style']);
164 }
165
166 add_action('wpforo_wrap_class', 'wpforo_classic_dark_class');