PluginProbe
Polylang / 0.1
Polylang v0.1
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / languages-form.php

languages-form.php in Polylang 0.1, at languages-form.php

118 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // displays the Languages admin panel
2
3 // I don't use the custom taxonomy form provide by Wordpress because I want to modify the labels below the fields...
4 // There is currently (3.2) no filter to do this
5
6 // The term fields are used as follows :
7 // name -> language name (used only for display)
8 // slug -> language code (ideally 2-letters ISO 639-1 language code but I currently use it only as slug so it doesn't matter)
9 // description -> WordPress Locale for the language. Here if something wrong is used, the .mo files will not be loaded...
10
11 ?>
12 <div class="wrap">
13 <?php screen_icon('options-general'); ?>
14 <h2><?php _e('Languages','polylang') ?></h2>
15
16 <div id="col-container">
17 <div id="col-right">
18 <div class="col-wrap">
19
20 <?php $list_table->display(); // displays the language list in a table ?>
21
22 </div> <!-- col-wrap -->
23 </div> <!-- col-right -->
24
25 <div id="col-left">
26 <div class="col-wrap">
27
28 <div class="form-wrap">
29 <h3><?php echo $action=='edit' ? _e('Edit language','polylang') : _e('Add new language','polylang'); ?></h3>
30
31 <?php // displays the add (or edit) language form
32
33 // adds noheader=true in the action url to allow using wp_redirect when processing the form ?>
34 <form id="add-lang" method="post" action="admin.php?page=mlang&amp;noheader=true" class="validate">
35 <?php wp_nonce_field('add-lang', '_wpnonce_add-lang');
36
37 if ($action=='edit') {?>
38 <input type="hidden" name="action" value="update" />
39 <input type="hidden" name="lang" value="<?php echo $edit_lang->term_id;?>" /><?php
40 }
41 else { ?>
42 <input type="hidden" name="action" value="add" /><?php
43 }?>
44
45 <div class="form-field form-required">
46 <label for="name"><?php _e('Full name', 'polylang');?></label>
47 <input name="name" id="name" type="text" value="<?php if ($action=='edit') echo $edit_lang->name;?>" size="40" aria-required="true" />
48 <p><?php _e('The name is how it is displayed on your site (for example: English).', 'polylang');?></p>
49 </div>
50
51 <div class="form-field form-required">
52 <label for="description"><?php _e('Locale', 'polylang');?></label>
53 <input name="description" id="description" type="text" value="<?php if ($action=='edit') echo $edit_lang->description;?>" size="40" aria-required="true" />
54 <p><?php _e('Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language.', 'polylang');?></p>
55 </div>
56
57 <div class="form-field">
58 <label for="slug"><?php _e('Language code', 'polylang');?></label>
59 <input name="slug" id="slug" type="text" value="<?php if ($action=='edit') echo $edit_lang->slug;?>" size="40" />
60 <p><?php _e('2-letters ISO 639-1 language code (for example: en)', 'polylang');?></p>
61 </div>
62
63 <?php if ($action=='edit')
64 submit_button(__('Update'), 'button'); // since WP 3.1
65 else
66 submit_button(__('Add new language', 'polylang'), 'button'); // since WP 3.1?>
67
68 </form>
69 </div> <!-- form-wrap -->
70 </div> <!-- col-wrap -->
71 </div> <!-- col-left -->
72 </div> <!-- col-container -->
73
74 <? // displays the Polylang options form
75 //FIXME one inline CSS ?>
76 <div class="form-wrap">
77 <h3><?php _e('Options','polylang');?></h3>
78
79 <form id="options-lang" method="post" action="admin.php?page=mlang" class="validate">
80 <?php wp_nonce_field('options-lang', '_wpnonce_options-lang');?>
81 <input type="hidden" name="action" value="options" />
82
83 <table class="form-table">
84
85 <tr>
86 <th style="width: 300px;"><label><?php printf ('<input name="rewrite" type="radio" value="0" %s /> %s',
87 $options['rewrite'] ? '' : 'checked="checked"', __('Keep /language/ in pretty permalinks', 'polylang')); ?></label></th>
88 <td><code><?php echo home_url('language/en/'); ?></code></td>
89 </tr>
90
91 <tr>
92 <th><label><?php printf ('<input name="rewrite" type="radio" value="1" %s /> %s',
93 $options['rewrite'] ? 'checked="checked"' : '', __('Remove /language/ in pretty permalinks', 'polylang')); ?></label></th>
94 <td><code><?php echo home_url('en/'); ?></code></td>
95 </tr>
96
97 <tr>
98 <th><?php _e('The front page default language is : ', 'polylang');?></th>
99 <td><label><?php printf('<input name="browser" type="checkbox" value="1" %s /> %s',
100 $options['browser'] ? 'checked="checked"' :'', __('set by the browser preference', 'polylang')) ?></label>
101 <label><?php _e('otherwise: ', 'polylang');?><select name="default_lang" id="default_lang">
102 <?php $listlanguages = $this->get_languages_list();
103 foreach ($listlanguages as $language) {
104 printf("<option value=%s %s >%s</option>\n", $language->slug, $options['default_lang'] == $language->slug ? 'selected="selected"' : '', $language->name);
105 } ?>
106 </select></label>
107 </td>
108 </tr>
109
110 </table>
111
112 <?php submit_button(); // since WP 3.1 ?>
113
114 </form>
115 </div> <!-- form-wrap -->
116
117 </div> <!-- wrap -->
118