PluginProbe
wpForo Forum / 1.3.1
wpForo Forum v1.3.1
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 1.4.2 All 137 releases
wpforo / wpf-themes / classic / functions.php

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

143 lines 7.2 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 if( file_exists(WPFORO_TEMPLATE_DIR . '/colors.css') ){
20 wp_register_style( 'wpforo-dynamic-style', WPFORO_TEMPLATE_URL . '/colors.css', false, WPFORO_VERSION );
21 wp_enqueue_style('wpforo-dynamic-style');
22 }
23 }
24 }
25 elseif ( !is_front_page() && !is_home() ) {
26 wp_register_style( 'wpforo-uidialog-style', WPFORO_URL . '/wpf-assets/css/jquery-ui.css', false, WPFORO_VERSION );
27 wp_enqueue_style('wpforo-uidialog-style');
28 }
29 }
30 add_action('wp_enqueue_scripts', 'wpforo_classic_wpforo_frontend_enqueue', 11);
31
32 function wpforo_classic_forum_options($wpforo){
33 ?>
34 <?php if($wpforo->tpl->layout_exists(1)): ?>
35 <?php
36 if(!isset($wpforo->forum_options['layout_extended_intro_topics_toggle'])) $wpforo->forum_options['layout_extended_intro_topics_toggle'] = 1;
37 if(!isset($wpforo->forum_options['layout_extended_intro_topics_count'])) $wpforo->forum_options['layout_extended_intro_topics_count'] = 3;
38 ?>
39 <tr>
40 <th><label><?php _e('Extended Layout - Intro topics','wpforo'); ?>:</label></th>
41 <td>
42 <div class="wpf-switch-field">
43 <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;
44 <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>
45 </div>
46 </td>
47 </tr>
48 <tr>
49 <th><label for="tdcs"><?php _e('Extended Layout - Number of intro topics','wpforo'); ?>:</label></th>
50 <td>
51 <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" />
52 </td>
53 </tr>
54 <?php endif; ?>
55 <?php if($wpforo->tpl->layout_exists(3)): ?>
56 <?php
57 if(!isset($wpforo->forum_options['layout_qa_intro_topics_toggle'])) $wpforo->forum_options['layout_qa_intro_topics_toggle'] = 1;
58 if(!isset($wpforo->forum_options['layout_qa_intro_topics_count'])) $wpforo->forum_options['layout_qa_intro_topics_count'] = 3;
59 ?>
60 <tr>
61 <th><label><?php _e('Q&A layout - Intro topics','wpforo'); ?>:</label></th>
62 <td>
63 <div class="wpf-switch-field">
64 <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;
65 <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>
66 </div>
67 </td>
68 </tr>
69 <tr>
70 <th><label for="tdcq"><?php _e('Q&A Layout - Number of intro topics','wpforo'); ?>:</label></th>
71 <td>
72 <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" />
73 </td>
74 </tr>
75 <?php endif; ?>
76 <?php
77 }
78 add_action('wpforo_settings_forums', 'wpforo_classic_forum_options');
79
80
81
82 function wpforo_classic_post_options($wpforo){
83 ?>
84 <?php if($wpforo->tpl->layout_exists(1)): ?>
85 <?php
86 if(!isset($wpforo->post_options['layout_extended_intro_posts_toggle'])) $wpforo->post_options['layout_extended_intro_posts_toggle'] = 1;
87 if(!isset($wpforo->post_options['layout_extended_intro_posts_count'])) $wpforo->post_options['layout_extended_intro_posts_count'] = 4;
88 ?>
89 <tr>
90 <th><label><?php _e('Extended Layout - Intro posts','wpforo'); ?></label></th>
91 <td>
92 <div class="wpf-switch-field">
93 <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;
94 <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>
95 </div>
96 </td>
97 </tr>
98 <tr>
99 <th>
100 <label for="tdcs"><?php _e('Extended Layout - Number of intro posts','wpforo'); ?></label>
101 <p class="wpf-info"><?php _e('Set this option value 0 if you want to show all posts under topic intro area.','wpforo'); ?></p>
102 </th>
103 <td>
104 <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" />
105 </td>
106 </tr>
107 <?php endif; ?>
108 <?php
109 }
110 add_action('wpforo_settings_post_top', 'wpforo_classic_post_options');
111
112
113
114 function wpforo_classic_reply_form_head($string, $args){
115 global $wpforo;
116 if( $wpforo->tpl->layout_exists(3) ){
117 if( $args['layout'] == 3 ){
118 $string = preg_replace('|(<p[^><]*id="wpf-reply-form-title"[^><]*>)(.+?)(</p>)|is', '$1'.wpforo_phrase('Your Answer', false, 'default').'$3', $string);
119 }
120 }
121 return $string;
122 }
123 add_filter('wpforo_reply_form_head', 'wpforo_classic_reply_form_head', 1, 2);
124
125
126
127 function wpforo_classic_reply_form_field_title($string, $args){
128 global $wpforo;
129 if( $wpforo->tpl->layout_exists(3) ){
130 if( $args['layout'] == 3 ){
131 $string = preg_replace('|[^\:]+\:|is', wpforo_phrase('Answer to', false, 'default') . ':', $string);
132 }
133 }
134 return $string;
135 }
136 add_filter('wpforo_reply_form_field_title', 'wpforo_classic_reply_form_field_title', 1, 2);
137
138 function wpforo_classic_dark_class( $wpforo ){
139 if(empty($wpforo)) return;
140 if(isset($wpforo->theme_options['style'])) echo 'wpf-' . esc_attr($wpforo->theme_options['style']);
141 }
142
143 add_action('wpforo_wrap_class', 'wpforo_classic_dark_class');