| 1 |
<?php |
| 2 |
namespace UltimatePostKit\Includes; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Class WPML_UPK_Pro_Post_Info |
| 10 |
* Handles translation of repeater items in the Post Info widget |
| 11 |
*/ |
| 12 |
class WPML_UPK_Pro_Post_Info extends WPML_Module_With_Items { |
| 13 |
|
| 14 |
/** |
| 15 |
* @return string |
| 16 |
*/ |
| 17 |
public function get_items_field() { |
| 18 |
return 'icon_list'; |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* @return array |
| 23 |
*/ |
| 24 |
public function get_fields() { |
| 25 |
return array( |
| 26 |
'text_prefix', |
| 27 |
'custom_text', |
| 28 |
'custom_date_format', |
| 29 |
'custom_time_format', |
| 30 |
'string_no_comments', |
| 31 |
'string_one_comment', |
| 32 |
'string_comments', |
| 33 |
'custom_url' => ['url'], |
| 34 |
); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* @param string $field |
| 39 |
* @return string |
| 40 |
*/ |
| 41 |
protected function get_title( $field ) { |
| 42 |
switch ( $field ) { |
| 43 |
case 'text_prefix': |
| 44 |
return esc_html__( 'Text Prefix', 'ultimate-post-kit' ); |
| 45 |
case 'custom_text': |
| 46 |
return esc_html__( 'Custom Text', 'ultimate-post-kit' ); |
| 47 |
case 'custom_date_format': |
| 48 |
return esc_html__( 'Custom Date Format', 'ultimate-post-kit' ); |
| 49 |
case 'custom_time_format': |
| 50 |
return esc_html__( 'Custom Time Format', 'ultimate-post-kit' ); |
| 51 |
case 'string_no_comments': |
| 52 |
return esc_html__( 'No Comments String', 'ultimate-post-kit' ); |
| 53 |
case 'string_one_comment': |
| 54 |
return esc_html__( 'One Comment String', 'ultimate-post-kit' ); |
| 55 |
case 'string_comments': |
| 56 |
return esc_html__( 'Comments String', 'ultimate-post-kit' ); |
| 57 |
case 'custom_url': |
| 58 |
return esc_html__( 'Custom URL', 'ultimate-post-kit' ); |
| 59 |
default: |
| 60 |
return ''; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* @param string $field |
| 66 |
* @return string |
| 67 |
*/ |
| 68 |
protected function get_editor_type( $field ) { |
| 69 |
switch ( $field ) { |
| 70 |
case 'text_prefix': |
| 71 |
case 'custom_text': |
| 72 |
case 'custom_date_format': |
| 73 |
case 'custom_time_format': |
| 74 |
case 'string_no_comments': |
| 75 |
case 'string_one_comment': |
| 76 |
case 'string_comments': |
| 77 |
return 'LINE'; |
| 78 |
case 'custom_url': |
| 79 |
return 'LINK'; |
| 80 |
default: |
| 81 |
return 'LINE'; |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
|