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