PluginProbe
Polylang / 2.7.3
Polylang v2.7.3
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
← All changes | settings/table-string.php +13 -47 3.0.32.7.3 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 if ( ! class_exists( 'WP_List_Table' ) ) {
7 4 require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; // since WP 3.1
8 5 }
@@ -13,42 +10,16 @@
13 10 *
14 11 * @since 0.6
15 12 */
16 13 class PLL_Table_String extends WP_List_Table {
17 - /**
18 - * The list of languages.
19 - *
20 - * @var PLL_Language[]
21 - */
22 - protected $languages;
14 + protected $languages, $strings, $groups, $selected_group;
23 15
24 16 /**
25 - * Registered strings.
17 + * Constructor
26 18 *
27 - * @var array
28 - */
29 - protected $strings;
30 -
31 - /**
32 - * The string groups.
33 - *
34 - * @var string[]
35 - */
36 - protected $groups;
37 -
38 - /**
39 - * The selected string group or -1 if none is selected.
40 - *
41 - * @var string|int
42 - */
43 - protected $selected_group;
44 -
45 - /**
46 - * Constructor.
47 - *
48 19 * @since 0.6
49 20 *
50 - * @param PLL_Language[] $languages List of languages.
21 + * @param array $languages list of languages
51 22 */
52 23 public function __construct( $languages ) {
53 24 parent::__construct(
54 25 array(
@@ -144,17 +115,17 @@
144 115 return $out;
145 116 }
146 117
147 118 /**
148 - * Gets the list of columns.
119 + * Gets the list of columns
149 120 *
150 121 * @since 0.6
151 122 *
152 - * @return string[] The list of column titles.
123 + * @return array the list of column titles
153 124 */
154 125 public function get_columns() {
155 126 return array(
156 - 'cb' => '<input type="checkbox" />', // Checkbox.
127 + 'cb' => '<input type="checkbox" />', // Checkbox
157 128 'string' => esc_html__( 'String', 'polylang' ),
158 129 'name' => esc_html__( 'Name', 'polylang' ),
159 130 'context' => esc_html__( 'Group', 'polylang' ),
160 131 'translations' => esc_html__( 'Translations', 'polylang' ),
@@ -191,11 +162,11 @@
191 162 * Search for a string in translations. Case insensitive.
192 163 *
193 164 * @since 2.6
194 165 *
195 - * @param PLL_MO[] $mos An array of PLL_MO objects.
196 - * @param string $s Searched string.
197 - * @return string[] Found strings.
166 + * @param array $mos An array of PLL_MO objects
167 + * @param string $s Searched string
168 + * @return array Found strings
198 169 */
199 170 protected function search_in_translations( $mos, $s ) {
200 171 $founds = array();
201 172
@@ -234,10 +205,8 @@
234 205 /**
235 206 * Prepares the list of items for displaying
236 207 *
237 208 * @since 0.6
238 - *
239 - * @return void
240 209 */
241 210 public function prepare_items() {
242 211 // Is admin language filter active?
243 212 if ( $lg = get_user_meta( get_current_user_id(), 'pll_filter_content', true ) ) {
@@ -302,13 +271,13 @@
302 271 }
303 272 }
304 273
305 274 /**
306 - * Get the list of possible bulk actions.
275 + * Get the list of possible bulk actions
307 276 *
308 277 * @since 1.1
309 278 *
310 - * @return string[] Array of bulk actions.
279 + * @return array
311 280 */
312 281 public function get_bulk_actions() {
313 282 return array( 'delete' => __( 'Delete', 'polylang' ) );
314 283 }
@@ -330,9 +299,8 @@
330 299 *
331 300 * @since 1.1
332 301 *
333 302 * @param string $which only 'top' is supported
334 - * @return void
335 303 */
336 304 public function extra_tablenav( $which ) {
337 305 if ( 'top' !== $which ) {
338 306 return;
@@ -346,9 +314,9 @@
346 314 );
347 315 echo '<select id="select-group" name="group">' . "\n";
348 316 printf(
349 317 '<option value="-1"%s>%s</option>' . "\n",
350 - selected( $this->selected_group, -1, false ),
318 + selected( $this->group_selected, -1, false ),
351 319 esc_html__( 'View all groups', 'polylang' )
352 320 );
353 321
354 322 foreach ( $this->groups as $group ) {
@@ -369,10 +337,8 @@
369 337 * Saves the strings translations in DB
370 338 * Optionaly clean the DB
371 339 *
372 340 * @since 1.9
373 - *
374 - * @return void
375 341 */
376 342 public function save_translations() {
377 343 check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
378 344
@@ -377,9 +343,9 @@
377 343 check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
378 344
379 345 if ( ! empty( $_POST['submit'] ) ) {
380 346 foreach ( $this->languages as $language ) {
381 - if ( empty( $_POST['translation'][ $language->slug ] ) || ! is_array( $_POST['translation'][ $language->slug ] ) ) { // In case the language filter is active ( thanks to John P. Bloch )
347 + if ( empty( $_POST['translation'][ $language->slug ] ) ) { // In case the language filter is active ( thanks to John P. Bloch )
382 348 continue;
383 349 }
384 350
385 351 $mo = new PLL_MO();