PluginProbe
wpForo Forum / 2.3.5
wpForo Forum v2.3.5
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 / admin / pages / phrase.php

phrase.php in wpForo Forum 2.3.5, at admin/pages/phrase.php

190 lines 8.7 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 if( ! WPF()->usergroup->can( 'mp' ) ) exit;
5
6 $wpfaction = wpfval( $_GET, 'wpfaction' );
7 ?>
8
9 <div id="wpf-admin-wrap" class="wrap" style="margin-top: 0">
10 <?php wpforo_screen_option() ?>
11 <div id="icon-users" class="icon32"><br></div>
12 <h2 style="padding:30px 0 0 0; line-height: 20px; margin-bottom:15px;">
13 <?php _e( 'Front-end Phrases', 'wpforo' ); ?> &nbsp;
14 <a class="add-new-h2" href="<?php echo admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'phrases' ) . '&wpfaction=phrase_add_form' ) ?>">
15 <?php _e( 'Add New', 'wpforo' ) ?>
16 </a>
17 </h2>
18 <?php WPF()->notice->show() ?>
19 <?php
20 if( $wpfaction === 'phrase_add_form' ) { ?>
21 <form method="POST" id="phrases" class="validate">
22 <?php wp_nonce_field( 'wpforo-phrase-add' ); ?>
23 <input type="hidden" name="wpfaction" value="phrase_add">
24 <table class="form-table">
25 <tr>
26 <td><?php _e( 'Language', 'wpforo' ) ?></td>
27 <td>
28 <select name="phrase[langid]">
29 <?php WPF()->phrase->show_lang_list(); ?>
30 </select>
31 </td>
32 </tr>
33 <tr>
34 <td><?php _e( 'Package', 'wpforo' ) ?></td>
35 <td>
36 <select name="phrase[package]">
37 <?php
38 if( $packages = WPF()->phrase->get_distinct_packages() ) {
39 foreach( $packages as $package ) {
40 printf(
41 '<option value="%1$s" %2$s>%3$s</option>',
42 esc_attr( $package ),
43 ( $package === 'wpforo' ) ? 'selected' : '',
44 esc_html( $package )
45 );
46 }
47 }
48 ?>
49 </select>
50 </td>
51 </tr>
52 <tr class="form-field form-required">
53 <td>
54 <label for="phrase_key"> <?php _e( 'Original', 'wpforo' ) ?></label>
55 </td>
56 <td>
57 <textarea name="phrase[key]" id="phrase_key" required style="min-height: 30px; height: 30px; width: 100%;"></textarea>
58 </td>
59 </tr>
60 <tr>
61 <td>
62 <label for="phrase_value"> <?php _e( 'Translation', 'wpforo' ) ?></label>
63 </td>
64 <td>
65 <textarea name="phrase[value]" id="phrase_value" required style="min-height: 30px; height: 30px; width: 100%;"></textarea>
66 </td>
67 </tr>
68 <tr>
69 <td colspan="2" style="text-align: right">
70 <input type="submit" id="createusersub" class="button button-primary" style="padding: 0 30px;" value="<?php _e( 'Save', 'wpforo' ) ?>">
71 </td>
72 </tr>
73 </table>
74 </form>
75 <?php
76 } elseif( $wpfaction === 'phrase_edit_form' ) {
77 if( wpfval( $_GET, 'phraseid' ) ) {
78 check_admin_referer( 'wpforo-phrase-edit-' . wpfval( $_GET, 'phraseid' ) );
79 } else {
80 check_admin_referer( 'bulk-phrases' );
81 }
82 $phraseids = array_merge( (array) wpfval( $_GET, 'phraseid' ), (array) wpfval( $_GET, 'phraseids' ) );
83 ?>
84 <form method="POST" id="phrases" class="validate">
85 <?php wp_nonce_field( 'wpforo-phrases-edit' ); ?>
86 <input type="hidden" name="wpfaction" value="phrase_edit">
87 <table class="form-table">
88 <?php foreach( $phraseids as $phraseid ) : ?>
89 <tr class="form-field form-required">
90 <th scope="row">
91 <?php $phrase = WPF()->phrase->get_phrase( $phraseid ); ?>
92 <label for="phrase-<?php echo $phrase['phraseid']; ?>">
93 <?php echo esc_html( $phrase['phrase_key'] ); ?>
94 </label>
95 </th>
96 <td>
97 <textarea
98 name="phrases[<?php echo intval( $phraseid ) ?>]"
99 id="phrase-<?php echo $phrase['phraseid']; ?>"
100 required
101 style="width:80%; min-height:30px; height:30px;"
102 ><?php wpfo( $phrase['phrase_value'], true, 'esc_textarea' ); ?></textarea>
103 </td>
104 </tr>
105 <?php endforeach; ?>
106 <tr>
107 <td colspan="2" style="text-align: right;">
108 <input type="submit" id="createusersub" class="button button-primary" style="padding: 0 30px" value="<?php _e( 'Update', 'wpforo' ) ?>">
109 </td>
110 </tr>
111 </table>
112 </form>
113 <?php
114 } elseif( $wpfaction === 'add_new_xml_translation_form' ) {
115 ?>
116 <form action="" method="POST" name="add_lang" class="validate" enctype="multipart/form-data">
117 <?php wp_nonce_field( 'wpforo-settings-language' ); ?>
118 <input type="hidden" name="wpfaction" value="add_new_xml_translation">
119 <table class="wpforo_settings_table">
120 <tbody>
121 <tr class="form-field form-required">
122 <td>
123 <b><label><?php _e( 'Language XML file', 'wpforo' ) ?>:</label></b>
124 </td>
125 <td>
126 <input type="file" name="add_lang[xml]" accept="text/xml">
127 </td>
128 </tr>
129 </tbody>
130 </table>
131 <div class="wpforo_settings_foot">
132 <input type="submit" class="button button-primary" value="<?php _e( 'Add New Language', 'wpforo' ); ?>">
133 </div>
134 </form>
135 <?php
136 } else {
137 ?>
138 <form method="get">
139 <input type="hidden" name="page" value="<?php echo wpforo_prefix_slug( 'phrases' ) ?>">
140 <?php WPF()->phrase->list_table->languages_dropdown() ?>
141 <?php WPF()->phrase->list_table->packages_dropdown() ?>
142 <input type="submit" value="<?php _e( 'Filter', 'wpforo' ) ?>" class="button button-large">
143
144 <?php WPF()->phrase->list_table->search_box( 'Search Phrases', 'wpf-phrase-search' ) ?>
145 </form>
146 <br>
147 <hr>
148 <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
149 <form id="wpf-dashboard-phrase-page" method="GET">
150 <!-- For plugins, we also need to ensure that the form posts back to our current page -->
151 <input type="hidden" name="page" value="<?php echo wpforo_prefix_slug( 'phrases' ) ?>">
152 <input type="hidden" name="wpfaction" value="phrase_edit_form">
153
154 <!-- Now we can render the completed list table -->
155 <?php WPF()->phrase->list_table->display() ?>
156 </form>
157
158
159 <hr style="margin-top: 30px;">
160
161 <form method="post">
162 <?php wp_nonce_field( 'wpforo-phrases-change-language' ); ?>
163 <input type="hidden" name="wpfaction" value="phrases_change_lang">
164 <table>
165 <tr>
166 <td style="padding-bottom: 10px;">
167 <label for="langid" style="font-weight: bold;"><?php _e( 'Manage Phrasees with XML File', 'wpforo' ); ?> <a href="https://wpforo.com/docs/wpforo-v2/wpforo-settings/general-settings/#xml-language" title="<?php _e( 'Read the documentation', 'wpforo' ) ?>" target="_blank"><i class="far fa-question-circle"></i></a></label>
168 <p class="wpf-info"><?php _e( 'This option is only related to XML language files. You should upload a translation XML file to have a new language option in this drop-down. If you are using PO/MO translation files you should change WordPress Language in Dashboard > Settings admin page to load according translation for wpForo.', 'wpforo' ); ?></p>
169 </td>
170 </tr>
171 <tr>
172 <td style="display: flex; justify-content: flex-start; align-items: center;">
173 <select id="langid" name="langid" style="float:left;">
174 <?php WPF()->phrase->show_lang_list() ?>
175 </select>
176 <input type="submit" class="button button-primary" value="<?php _e( 'Change', 'wpforo' ) ?>">
177 </td>
178 </tr>
179 <tr>
180 <td style="padding-top: 10px;">
181 <a href="<?php echo admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'phrases' ) . '&wpfaction=add_new_xml_translation_form' ) ?>" class="add-new-h2"><?php _e( 'Add New', 'wpforo' ); ?></a>
182 </td>
183 </tr>
184 </table>
185 </form>
186 <?php
187 }
188 ?>
189 </div>
190