@@ -18,42 +18,42 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Url_Property_Storage extends Wordlift_Storage { |
20 | 20 | |
21 | - /** |
|
22 | - * The {@link Wordlift_Property_Getter} instance. |
|
23 | - * |
|
24 | - * @since 3.15.0 |
|
25 | - * @access private |
|
26 | - * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} |
|
27 | - * instance. |
|
28 | - */ |
|
29 | - private $property_getter; |
|
30 | - |
|
31 | - /** |
|
32 | - * Create a {@link Wordlift_Property_Storage} instance. |
|
33 | - * |
|
34 | - * @since 3.15.0 |
|
35 | - * |
|
36 | - * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} |
|
37 | - * instance. |
|
38 | - */ |
|
39 | - public function __construct( $property_getter ) { |
|
40 | - |
|
41 | - $this->property_getter = $property_getter; |
|
42 | - |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Get the values for the property of the {@link WP_Post}. |
|
47 | - * |
|
48 | - * @since 3.15.0 |
|
49 | - * |
|
50 | - * @param int $post_id The {@link WP_Post}'s id. |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function get( $post_id ) { |
|
55 | - |
|
56 | - return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST ); |
|
57 | - } |
|
21 | + /** |
|
22 | + * The {@link Wordlift_Property_Getter} instance. |
|
23 | + * |
|
24 | + * @since 3.15.0 |
|
25 | + * @access private |
|
26 | + * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} |
|
27 | + * instance. |
|
28 | + */ |
|
29 | + private $property_getter; |
|
30 | + |
|
31 | + /** |
|
32 | + * Create a {@link Wordlift_Property_Storage} instance. |
|
33 | + * |
|
34 | + * @since 3.15.0 |
|
35 | + * |
|
36 | + * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} |
|
37 | + * instance. |
|
38 | + */ |
|
39 | + public function __construct( $property_getter ) { |
|
40 | + |
|
41 | + $this->property_getter = $property_getter; |
|
42 | + |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Get the values for the property of the {@link WP_Post}. |
|
47 | + * |
|
48 | + * @since 3.15.0 |
|
49 | + * |
|
50 | + * @param int $post_id The {@link WP_Post}'s id. |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function get( $post_id ) { |
|
55 | + |
|
56 | + return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST ); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} |
37 | 37 | * instance. |
38 | 38 | */ |
39 | - public function __construct( $property_getter ) { |
|
39 | + public function __construct($property_getter) { |
|
40 | 40 | |
41 | 41 | $this->property_getter = $property_getter; |
42 | 42 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return array |
53 | 53 | */ |
54 | - public function get( $post_id ) { |
|
54 | + public function get($post_id) { |
|
55 | 55 | |
56 | - return $this->property_getter->get( $post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST ); |
|
56 | + return $this->property_getter->get($post_id, Wordlift_Schema_Url_Property_Service::META_KEY, Object_Type_Enum::POST); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * |
22 | 22 | * @return Relation_Service_Interface |
23 | 23 | */ |
24 | - public static function get_instance( $post_id ) { |
|
24 | + public static function get_instance($post_id) { |
|
25 | 25 | // The post type doesnt have an editor and no-editor-analysis feature is turned on. |
26 | - if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
26 | + if (No_Editor_Analysis_Feature::can_no_editor_analysis_be_used($post_id)) { |
|
27 | 27 | return Object_No_Annotation_Relation_Service::get_instance(); |
28 | 28 | } |
29 | 29 |
@@ -15,19 +15,19 @@ |
||
15 | 15 | |
16 | 16 | class Object_Relation_Factory { |
17 | 17 | |
18 | - /** |
|
19 | - * @param int $post_id |
|
20 | - * |
|
21 | - * @return Relation_Service_Interface |
|
22 | - */ |
|
23 | - public static function get_instance( $post_id ) { |
|
24 | - // The post type doesnt have an editor and no-editor-analysis feature is turned on. |
|
25 | - if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
26 | - return Object_No_Annotation_Relation_Service::get_instance(); |
|
27 | - } |
|
18 | + /** |
|
19 | + * @param int $post_id |
|
20 | + * |
|
21 | + * @return Relation_Service_Interface |
|
22 | + */ |
|
23 | + public static function get_instance( $post_id ) { |
|
24 | + // The post type doesnt have an editor and no-editor-analysis feature is turned on. |
|
25 | + if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
26 | + return Object_No_Annotation_Relation_Service::get_instance(); |
|
27 | + } |
|
28 | 28 | |
29 | - return Object_Relation_Service::get_instance(); |
|
29 | + return Object_Relation_Service::get_instance(); |
|
30 | 30 | |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | } |
@@ -17,18 +17,18 @@ |
||
17 | 17 | */ |
18 | 18 | class Analysis_Service_Factory { |
19 | 19 | |
20 | - /** |
|
21 | - * Get the analysis service conditionally. |
|
22 | - * |
|
23 | - * @return Analysis_Service |
|
24 | - */ |
|
25 | - public static function get_instance( $post_id ) { |
|
26 | - // We want this analysis to happen only when the editor is not present. |
|
27 | - if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
28 | - return No_Editor_Analysis_Service::get_instance(); |
|
29 | - } |
|
20 | + /** |
|
21 | + * Get the analysis service conditionally. |
|
22 | + * |
|
23 | + * @return Analysis_Service |
|
24 | + */ |
|
25 | + public static function get_instance( $post_id ) { |
|
26 | + // We want this analysis to happen only when the editor is not present. |
|
27 | + if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
28 | + return No_Editor_Analysis_Service::get_instance(); |
|
29 | + } |
|
30 | 30 | |
31 | - return V1_Analysis_Service::get_instance(); |
|
32 | - } |
|
31 | + return V1_Analysis_Service::get_instance(); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | } |
@@ -22,9 +22,9 @@ |
||
22 | 22 | * |
23 | 23 | * @return Analysis_Service |
24 | 24 | */ |
25 | - public static function get_instance( $post_id ) { |
|
25 | + public static function get_instance($post_id) { |
|
26 | 26 | // We want this analysis to happen only when the editor is not present. |
27 | - if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
27 | + if (No_Editor_Analysis_Feature::can_no_editor_analysis_be_used($post_id)) { |
|
28 | 28 | return No_Editor_Analysis_Service::get_instance(); |
29 | 29 | } |
30 | 30 |
@@ -15,19 +15,19 @@ |
||
15 | 15 | */ |
16 | 16 | abstract class Abstract_Analysis_Service extends Singleton implements Analysis_Service { |
17 | 17 | |
18 | - /** |
|
19 | - * Wordlift api service. |
|
20 | - * |
|
21 | - * @var \Wordlift_Api_Service |
|
22 | - */ |
|
23 | - protected $api_service; |
|
18 | + /** |
|
19 | + * Wordlift api service. |
|
20 | + * |
|
21 | + * @var \Wordlift_Api_Service |
|
22 | + */ |
|
23 | + protected $api_service; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Abstract_Analysis_Service constructor. |
|
27 | - */ |
|
28 | - public function __construct() { |
|
29 | - parent::__construct(); |
|
30 | - $this->api_service = \Wordlift_Api_Service::get_instance(); |
|
31 | - } |
|
25 | + /** |
|
26 | + * Abstract_Analysis_Service constructor. |
|
27 | + */ |
|
28 | + public function __construct() { |
|
29 | + parent::__construct(); |
|
30 | + $this->api_service = \Wordlift_Api_Service::get_instance(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | } |
@@ -15,8 +15,8 @@ |
||
15 | 15 | * |
16 | 16 | * @return Occurrences |
17 | 17 | */ |
18 | - public static function get_instance( $post_id ) { |
|
19 | - if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
18 | + public static function get_instance($post_id) { |
|
19 | + if (No_Editor_Analysis_Feature::can_no_editor_analysis_be_used($post_id)) { |
|
20 | 20 | return No_Annotation_Strategy::get_instance(); |
21 | 21 | } |
22 | 22 | return Default_Strategy::get_instance(); |
@@ -11,16 +11,16 @@ |
||
11 | 11 | |
12 | 12 | class Occurrences_Factory { |
13 | 13 | |
14 | - /** |
|
15 | - * @param $post_id |
|
16 | - * |
|
17 | - * @return Occurrences |
|
18 | - */ |
|
19 | - public static function get_instance( $post_id ) { |
|
20 | - if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
21 | - return No_Annotation_Strategy::get_instance(); |
|
22 | - } |
|
23 | - return Default_Strategy::get_instance(); |
|
24 | - } |
|
14 | + /** |
|
15 | + * @param $post_id |
|
16 | + * |
|
17 | + * @return Occurrences |
|
18 | + */ |
|
19 | + public static function get_instance( $post_id ) { |
|
20 | + if ( No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( $post_id ) ) { |
|
21 | + return No_Annotation_Strategy::get_instance(); |
|
22 | + } |
|
23 | + return Default_Strategy::get_instance(); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | } |
@@ -14,15 +14,15 @@ |
||
14 | 14 | */ |
15 | 15 | interface Analysis_Service { |
16 | 16 | |
17 | - /** |
|
18 | - * Return analysis response from the service. |
|
19 | - * |
|
20 | - * @param array $data The analysis data. |
|
21 | - * @param String $content_type Content type for the request. |
|
22 | - * @param int $post_id Post id. |
|
23 | - * |
|
24 | - * @return string|object|\WP_Error A {@link WP_Error} instance or the actual response content. |
|
25 | - */ |
|
26 | - public function get_analysis_response( $data, $content_type, $post_id ); |
|
17 | + /** |
|
18 | + * Return analysis response from the service. |
|
19 | + * |
|
20 | + * @param array $data The analysis data. |
|
21 | + * @param String $content_type Content type for the request. |
|
22 | + * @param int $post_id Post id. |
|
23 | + * |
|
24 | + * @return string|object|\WP_Error A {@link WP_Error} instance or the actual response content. |
|
25 | + */ |
|
26 | + public function get_analysis_response( $data, $content_type, $post_id ); |
|
27 | 27 | |
28 | 28 | } |
@@ -23,6 +23,6 @@ |
||
23 | 23 | * |
24 | 24 | * @return string|object|\WP_Error A {@link WP_Error} instance or the actual response content. |
25 | 25 | */ |
26 | - public function get_analysis_response( $data, $content_type, $post_id ); |
|
26 | + public function get_analysis_response($data, $content_type, $post_id); |
|
27 | 27 | |
28 | 28 | } |
@@ -8,9 +8,9 @@ |
||
8 | 8 | |
9 | 9 | interface Occurrences { |
10 | 10 | |
11 | - /** |
|
12 | - * @return array Return json data structure. |
|
13 | - */ |
|
14 | - public function add_occurences_to_entities( $occurrences, $json, $post_id ); |
|
11 | + /** |
|
12 | + * @return array Return json data structure. |
|
13 | + */ |
|
14 | + public function add_occurences_to_entities( $occurrences, $json, $post_id ); |
|
15 | 15 | |
16 | 16 | } |
@@ -11,6 +11,6 @@ |
||
11 | 11 | /** |
12 | 12 | * @return array Return json data structure. |
13 | 13 | */ |
14 | - public function add_occurences_to_entities( $occurrences, $json, $post_id ); |
|
14 | + public function add_occurences_to_entities($occurrences, $json, $post_id); |
|
15 | 15 | |
16 | 16 | } |
@@ -13,33 +13,33 @@ |
||
13 | 13 | |
14 | 14 | class Loader extends Default_Loader { |
15 | 15 | |
16 | - public function init_all_dependencies() { |
|
17 | - $edit_screen_setting = new Edit_Screen_Setting(); |
|
18 | - $edit_screen_setting->add_setting(); |
|
19 | - $meta_box = new Meta_Box(); |
|
20 | - $meta_box->init(); |
|
21 | - $edit_post_scripts = new Edit_Post_Scripts(); |
|
22 | - $edit_post_scripts->init(); |
|
23 | - |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * Return the feature slug. |
|
28 | - * |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - protected function get_feature_slug() { |
|
32 | - return 'no-editor-analysis'; |
|
33 | - } |
|
34 | - |
|
35 | - /** |
|
36 | - * Return if the feature needs to be on by default. |
|
37 | - * |
|
38 | - * @return false |
|
39 | - */ |
|
40 | - protected function get_feature_default_value() { |
|
41 | - return false; |
|
42 | - } |
|
16 | + public function init_all_dependencies() { |
|
17 | + $edit_screen_setting = new Edit_Screen_Setting(); |
|
18 | + $edit_screen_setting->add_setting(); |
|
19 | + $meta_box = new Meta_Box(); |
|
20 | + $meta_box->init(); |
|
21 | + $edit_post_scripts = new Edit_Post_Scripts(); |
|
22 | + $edit_post_scripts->init(); |
|
23 | + |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * Return the feature slug. |
|
28 | + * |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + protected function get_feature_slug() { |
|
32 | + return 'no-editor-analysis'; |
|
33 | + } |
|
34 | + |
|
35 | + /** |
|
36 | + * Return if the feature needs to be on by default. |
|
37 | + * |
|
38 | + * @return false |
|
39 | + */ |
|
40 | + protected function get_feature_default_value() { |
|
41 | + return false; |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | |
45 | 45 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 3.9.0 |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | public static function get_languages() { |
86 | 86 | |
87 | 87 | // Lazily load the languages. |
88 | - if ( null === self::$languages ) { |
|
88 | + if (null === self::$languages) { |
|
89 | 89 | |
90 | 90 | // Get the language names from WP's own (multisite) function. |
91 | - foreach ( self::$codes as $key ) { |
|
92 | - self::$languages[ $key ] = self::get_language_name( $key ); |
|
91 | + foreach (self::$codes as $key) { |
|
92 | + self::$languages[$key] = self::get_language_name($key); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Sort by language name. |
96 | - asort( self::$languages ); |
|
96 | + asort(self::$languages); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return self::$languages; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @return string The language corresponding to $code if it exists. If it does not exist, |
110 | 110 | * then the first two letters of $code is returned. |
111 | 111 | */ |
112 | - public static function get_language_name( $code = '' ) { |
|
113 | - $code = strtolower( substr( $code, 0, 2 ) ); |
|
112 | + public static function get_language_name($code = '') { |
|
113 | + $code = strtolower(substr($code, 0, 2)); |
|
114 | 114 | $lang_codes = array( |
115 | 115 | 'aa' => 'Afar', |
116 | 116 | 'ab' => 'Abkhazian', |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | * @param array $lang_codes Key/value pair of language codes where key is the short version. |
308 | 308 | * @param string $code A two-letter designation of the language. |
309 | 309 | */ |
310 | - $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); |
|
310 | + $lang_codes = apply_filters('lang_codes', $lang_codes, $code); |
|
311 | 311 | |
312 | - return strtr( $code, $lang_codes ); |
|
312 | + return strtr($code, $lang_codes); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
14 | - exit; |
|
14 | + exit; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -21,295 +21,295 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Wordlift_Languages { |
23 | 23 | |
24 | - /** |
|
25 | - * An array that will contain language codes => language names pairs. It gets lazily loaded the first time by the |
|
26 | - * `get_languages` function. |
|
27 | - * |
|
28 | - * @since 3.9.0 |
|
29 | - * @var array|null An array of language codes => language names pairs or NULL if not initialized yet. |
|
30 | - */ |
|
31 | - private static $languages = null; |
|
24 | + /** |
|
25 | + * An array that will contain language codes => language names pairs. It gets lazily loaded the first time by the |
|
26 | + * `get_languages` function. |
|
27 | + * |
|
28 | + * @since 3.9.0 |
|
29 | + * @var array|null An array of language codes => language names pairs or NULL if not initialized yet. |
|
30 | + */ |
|
31 | + private static $languages = null; |
|
32 | 32 | |
33 | - /** |
|
34 | - * The list of supported language codes. |
|
35 | - * |
|
36 | - * @since 3.9.0 |
|
37 | - * |
|
38 | - * @var array An array of language codes. |
|
39 | - */ |
|
40 | - private static $codes = array( |
|
41 | - 'ar', |
|
42 | - 'be', |
|
43 | - 'bg', |
|
44 | - 'ca', |
|
45 | - 'cs', |
|
46 | - 'da', |
|
47 | - 'de', |
|
48 | - 'el', |
|
49 | - 'en', |
|
50 | - 'es', |
|
51 | - 'et', |
|
52 | - 'fi', |
|
53 | - 'fr', |
|
54 | - 'he', |
|
55 | - 'hr', |
|
56 | - 'hu', |
|
57 | - 'id', |
|
58 | - 'is', |
|
59 | - 'it', |
|
60 | - 'lt', |
|
61 | - 'lv', |
|
62 | - 'nl', |
|
63 | - 'no', |
|
64 | - 'pl', |
|
65 | - 'pt', |
|
66 | - 'ro', |
|
67 | - 'ru', |
|
68 | - 'sk', |
|
69 | - 'sl', |
|
70 | - 'sq', |
|
71 | - 'sr', |
|
72 | - 'sv', |
|
73 | - 'tr', |
|
74 | - 'uk', |
|
75 | - 'zh-cn', |
|
76 | - ); |
|
33 | + /** |
|
34 | + * The list of supported language codes. |
|
35 | + * |
|
36 | + * @since 3.9.0 |
|
37 | + * |
|
38 | + * @var array An array of language codes. |
|
39 | + */ |
|
40 | + private static $codes = array( |
|
41 | + 'ar', |
|
42 | + 'be', |
|
43 | + 'bg', |
|
44 | + 'ca', |
|
45 | + 'cs', |
|
46 | + 'da', |
|
47 | + 'de', |
|
48 | + 'el', |
|
49 | + 'en', |
|
50 | + 'es', |
|
51 | + 'et', |
|
52 | + 'fi', |
|
53 | + 'fr', |
|
54 | + 'he', |
|
55 | + 'hr', |
|
56 | + 'hu', |
|
57 | + 'id', |
|
58 | + 'is', |
|
59 | + 'it', |
|
60 | + 'lt', |
|
61 | + 'lv', |
|
62 | + 'nl', |
|
63 | + 'no', |
|
64 | + 'pl', |
|
65 | + 'pt', |
|
66 | + 'ro', |
|
67 | + 'ru', |
|
68 | + 'sk', |
|
69 | + 'sl', |
|
70 | + 'sq', |
|
71 | + 'sr', |
|
72 | + 'sv', |
|
73 | + 'tr', |
|
74 | + 'uk', |
|
75 | + 'zh-cn', |
|
76 | + ); |
|
77 | 77 | |
78 | - /** |
|
79 | - * Get the list of WordLift's supported languages in an array with language code => language name pairs. |
|
80 | - * |
|
81 | - * @since 3.9.0 |
|
82 | - * |
|
83 | - * @return array An array with language code => language name pairs. |
|
84 | - */ |
|
85 | - public static function get_languages() { |
|
78 | + /** |
|
79 | + * Get the list of WordLift's supported languages in an array with language code => language name pairs. |
|
80 | + * |
|
81 | + * @since 3.9.0 |
|
82 | + * |
|
83 | + * @return array An array with language code => language name pairs. |
|
84 | + */ |
|
85 | + public static function get_languages() { |
|
86 | 86 | |
87 | - // Lazily load the languages. |
|
88 | - if ( null === self::$languages ) { |
|
87 | + // Lazily load the languages. |
|
88 | + if ( null === self::$languages ) { |
|
89 | 89 | |
90 | - // Get the language names from WP's own (multisite) function. |
|
91 | - foreach ( self::$codes as $key ) { |
|
92 | - self::$languages[ $key ] = self::get_language_name( $key ); |
|
93 | - } |
|
90 | + // Get the language names from WP's own (multisite) function. |
|
91 | + foreach ( self::$codes as $key ) { |
|
92 | + self::$languages[ $key ] = self::get_language_name( $key ); |
|
93 | + } |
|
94 | 94 | |
95 | - // Sort by language name. |
|
96 | - asort( self::$languages ); |
|
97 | - } |
|
95 | + // Sort by language name. |
|
96 | + asort( self::$languages ); |
|
97 | + } |
|
98 | 98 | |
99 | - return self::$languages; |
|
100 | - } |
|
99 | + return self::$languages; |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Returns the language for a language code. This function is a clone of WP's function provided in `ms.php`. |
|
104 | - * |
|
105 | - * @since 3.9.3 |
|
106 | - * |
|
107 | - * @param string $code Optional. The two-letter language code. Default empty. |
|
108 | - * |
|
109 | - * @return string The language corresponding to $code if it exists. If it does not exist, |
|
110 | - * then the first two letters of $code is returned. |
|
111 | - */ |
|
112 | - public static function get_language_name( $code = '' ) { |
|
113 | - $code = strtolower( substr( $code, 0, 2 ) ); |
|
114 | - $lang_codes = array( |
|
115 | - 'aa' => 'Afar', |
|
116 | - 'ab' => 'Abkhazian', |
|
117 | - 'af' => 'Afrikaans', |
|
118 | - 'ak' => 'Akan', |
|
119 | - 'sq' => 'Albanian', |
|
120 | - 'am' => 'Amharic', |
|
121 | - 'ar' => 'Arabic', |
|
122 | - 'an' => 'Aragonese', |
|
123 | - 'hy' => 'Armenian', |
|
124 | - 'as' => 'Assamese', |
|
125 | - 'av' => 'Avaric', |
|
126 | - 'ae' => 'Avestan', |
|
127 | - 'ay' => 'Aymara', |
|
128 | - 'az' => 'Azerbaijani', |
|
129 | - 'ba' => 'Bashkir', |
|
130 | - 'bm' => 'Bambara', |
|
131 | - 'eu' => 'Basque', |
|
132 | - 'be' => 'Belarusian', |
|
133 | - 'bn' => 'Bengali', |
|
134 | - 'bh' => 'Bihari', |
|
135 | - 'bi' => 'Bislama', |
|
136 | - 'bs' => 'Bosnian', |
|
137 | - 'br' => 'Breton', |
|
138 | - 'bg' => 'Bulgarian', |
|
139 | - 'my' => 'Burmese', |
|
140 | - 'ca' => 'Catalan; Valencian', |
|
141 | - 'ch' => 'Chamorro', |
|
142 | - 'ce' => 'Chechen', |
|
143 | - 'zh' => 'Chinese', |
|
144 | - 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', |
|
145 | - 'cv' => 'Chuvash', |
|
146 | - 'kw' => 'Cornish', |
|
147 | - 'co' => 'Corsican', |
|
148 | - 'cr' => 'Cree', |
|
149 | - 'cs' => 'Czech', |
|
150 | - 'da' => 'Danish', |
|
151 | - 'dv' => 'Divehi; Dhivehi; Maldivian', |
|
152 | - 'nl' => 'Dutch; Flemish', |
|
153 | - 'dz' => 'Dzongkha', |
|
154 | - 'en' => 'English', |
|
155 | - 'eo' => 'Esperanto', |
|
156 | - 'et' => 'Estonian', |
|
157 | - 'ee' => 'Ewe', |
|
158 | - 'fo' => 'Faroese', |
|
159 | - 'fj' => 'Fijjian', |
|
160 | - 'fi' => 'Finnish', |
|
161 | - 'fr' => 'French', |
|
162 | - 'fy' => 'Western Frisian', |
|
163 | - 'ff' => 'Fulah', |
|
164 | - 'ka' => 'Georgian', |
|
165 | - 'de' => 'German', |
|
166 | - 'gd' => 'Gaelic; Scottish Gaelic', |
|
167 | - 'ga' => 'Irish', |
|
168 | - 'gl' => 'Galician', |
|
169 | - 'gv' => 'Manx', |
|
170 | - 'el' => 'Greek, Modern', |
|
171 | - 'gn' => 'Guarani', |
|
172 | - 'gu' => 'Gujarati', |
|
173 | - 'ht' => 'Haitian; Haitian Creole', |
|
174 | - 'ha' => 'Hausa', |
|
175 | - 'he' => 'Hebrew', |
|
176 | - 'hz' => 'Herero', |
|
177 | - 'hi' => 'Hindi', |
|
178 | - 'ho' => 'Hiri Motu', |
|
179 | - 'hu' => 'Hungarian', |
|
180 | - 'ig' => 'Igbo', |
|
181 | - 'is' => 'Icelandic', |
|
182 | - 'io' => 'Ido', |
|
183 | - 'ii' => 'Sichuan Yi', |
|
184 | - 'iu' => 'Inuktitut', |
|
185 | - 'ie' => 'Interlingue', |
|
186 | - 'ia' => 'Interlingua (International Auxiliary Language Association)', |
|
187 | - 'id' => 'Indonesian', |
|
188 | - 'ik' => 'Inupiaq', |
|
189 | - 'it' => 'Italian', |
|
190 | - 'jv' => 'Javanese', |
|
191 | - 'ja' => 'Japanese', |
|
192 | - 'kl' => 'Kalaallisut; Greenlandic', |
|
193 | - 'kn' => 'Kannada', |
|
194 | - 'ks' => 'Kashmiri', |
|
195 | - 'kr' => 'Kanuri', |
|
196 | - 'kk' => 'Kazakh', |
|
197 | - 'km' => 'Central Khmer', |
|
198 | - 'ki' => 'Kikuyu; Gikuyu', |
|
199 | - 'rw' => 'Kinyarwanda', |
|
200 | - 'ky' => 'Kirghiz; Kyrgyz', |
|
201 | - 'kv' => 'Komi', |
|
202 | - 'kg' => 'Kongo', |
|
203 | - 'ko' => 'Korean', |
|
204 | - 'kj' => 'Kuanyama; Kwanyama', |
|
205 | - 'ku' => 'Kurdish', |
|
206 | - 'lo' => 'Lao', |
|
207 | - 'la' => 'Latin', |
|
208 | - 'lv' => 'Latvian', |
|
209 | - 'li' => 'Limburgan; Limburger; Limburgish', |
|
210 | - 'ln' => 'Lingala', |
|
211 | - 'lt' => 'Lithuanian', |
|
212 | - 'lb' => 'Luxembourgish; Letzeburgesch', |
|
213 | - 'lu' => 'Luba-Katanga', |
|
214 | - 'lg' => 'Ganda', |
|
215 | - 'mk' => 'Macedonian', |
|
216 | - 'mh' => 'Marshallese', |
|
217 | - 'ml' => 'Malayalam', |
|
218 | - 'mi' => 'Maori', |
|
219 | - 'mr' => 'Marathi', |
|
220 | - 'ms' => 'Malay', |
|
221 | - 'mg' => 'Malagasy', |
|
222 | - 'mt' => 'Maltese', |
|
223 | - 'mo' => 'Moldavian', |
|
224 | - 'mn' => 'Mongolian', |
|
225 | - 'na' => 'Nauru', |
|
226 | - 'nv' => 'Navajo; Navaho', |
|
227 | - 'nr' => 'Ndebele, South; South Ndebele', |
|
228 | - 'nd' => 'Ndebele, North; North Ndebele', |
|
229 | - 'ng' => 'Ndonga', |
|
230 | - 'ne' => 'Nepali', |
|
231 | - 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', |
|
232 | - 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', |
|
233 | - 'no' => 'Norwegian', |
|
234 | - 'ny' => 'Chichewa; Chewa; Nyanja', |
|
235 | - 'oc' => 'Occitan, Provençal', |
|
236 | - 'oj' => 'Ojibwa', |
|
237 | - 'or' => 'Oriya', |
|
238 | - 'om' => 'Oromo', |
|
239 | - 'os' => 'Ossetian; Ossetic', |
|
240 | - 'pa' => 'Panjabi; Punjabi', |
|
241 | - 'fa' => 'Persian', |
|
242 | - 'pi' => 'Pali', |
|
243 | - 'pl' => 'Polish', |
|
244 | - 'pt' => 'Portuguese', |
|
245 | - 'ps' => 'Pushto', |
|
246 | - 'qu' => 'Quechua', |
|
247 | - 'rm' => 'Romansh', |
|
248 | - 'ro' => 'Romanian', |
|
249 | - 'rn' => 'Rundi', |
|
250 | - 'ru' => 'Russian', |
|
251 | - 'sg' => 'Sango', |
|
252 | - 'sa' => 'Sanskrit', |
|
253 | - 'sr' => 'Serbian', |
|
254 | - 'hr' => 'Croatian', |
|
255 | - 'si' => 'Sinhala; Sinhalese', |
|
256 | - 'sk' => 'Slovak', |
|
257 | - 'sl' => 'Slovenian', |
|
258 | - 'se' => 'Northern Sami', |
|
259 | - 'sm' => 'Samoan', |
|
260 | - 'sn' => 'Shona', |
|
261 | - 'sd' => 'Sindhi', |
|
262 | - 'so' => 'Somali', |
|
263 | - 'st' => 'Sotho, Southern', |
|
264 | - 'es' => 'Spanish; Castilian', |
|
265 | - 'sc' => 'Sardinian', |
|
266 | - 'ss' => 'Swati', |
|
267 | - 'su' => 'Sundanese', |
|
268 | - 'sw' => 'Swahili', |
|
269 | - 'sv' => 'Swedish', |
|
270 | - 'ty' => 'Tahitian', |
|
271 | - 'ta' => 'Tamil', |
|
272 | - 'tt' => 'Tatar', |
|
273 | - 'te' => 'Telugu', |
|
274 | - 'tg' => 'Tajik', |
|
275 | - 'tl' => 'Tagalog', |
|
276 | - 'th' => 'Thai', |
|
277 | - 'bo' => 'Tibetan', |
|
278 | - 'ti' => 'Tigrinya', |
|
279 | - 'to' => 'Tonga (Tonga Islands)', |
|
280 | - 'tn' => 'Tswana', |
|
281 | - 'ts' => 'Tsonga', |
|
282 | - 'tk' => 'Turkmen', |
|
283 | - 'tr' => 'Turkish', |
|
284 | - 'tw' => 'Twi', |
|
285 | - 'ug' => 'Uighur; Uyghur', |
|
286 | - 'uk' => 'Ukrainian', |
|
287 | - 'ur' => 'Urdu', |
|
288 | - 'uz' => 'Uzbek', |
|
289 | - 've' => 'Venda', |
|
290 | - 'vi' => 'Vietnamese', |
|
291 | - 'vo' => 'Volapük', |
|
292 | - 'cy' => 'Welsh', |
|
293 | - 'wa' => 'Walloon', |
|
294 | - 'wo' => 'Wolof', |
|
295 | - 'xh' => 'Xhosa', |
|
296 | - 'yi' => 'Yiddish', |
|
297 | - 'yo' => 'Yoruba', |
|
298 | - 'za' => 'Zhuang; Chuang', |
|
299 | - 'zu' => 'Zulu', |
|
300 | - ); |
|
102 | + /** |
|
103 | + * Returns the language for a language code. This function is a clone of WP's function provided in `ms.php`. |
|
104 | + * |
|
105 | + * @since 3.9.3 |
|
106 | + * |
|
107 | + * @param string $code Optional. The two-letter language code. Default empty. |
|
108 | + * |
|
109 | + * @return string The language corresponding to $code if it exists. If it does not exist, |
|
110 | + * then the first two letters of $code is returned. |
|
111 | + */ |
|
112 | + public static function get_language_name( $code = '' ) { |
|
113 | + $code = strtolower( substr( $code, 0, 2 ) ); |
|
114 | + $lang_codes = array( |
|
115 | + 'aa' => 'Afar', |
|
116 | + 'ab' => 'Abkhazian', |
|
117 | + 'af' => 'Afrikaans', |
|
118 | + 'ak' => 'Akan', |
|
119 | + 'sq' => 'Albanian', |
|
120 | + 'am' => 'Amharic', |
|
121 | + 'ar' => 'Arabic', |
|
122 | + 'an' => 'Aragonese', |
|
123 | + 'hy' => 'Armenian', |
|
124 | + 'as' => 'Assamese', |
|
125 | + 'av' => 'Avaric', |
|
126 | + 'ae' => 'Avestan', |
|
127 | + 'ay' => 'Aymara', |
|
128 | + 'az' => 'Azerbaijani', |
|
129 | + 'ba' => 'Bashkir', |
|
130 | + 'bm' => 'Bambara', |
|
131 | + 'eu' => 'Basque', |
|
132 | + 'be' => 'Belarusian', |
|
133 | + 'bn' => 'Bengali', |
|
134 | + 'bh' => 'Bihari', |
|
135 | + 'bi' => 'Bislama', |
|
136 | + 'bs' => 'Bosnian', |
|
137 | + 'br' => 'Breton', |
|
138 | + 'bg' => 'Bulgarian', |
|
139 | + 'my' => 'Burmese', |
|
140 | + 'ca' => 'Catalan; Valencian', |
|
141 | + 'ch' => 'Chamorro', |
|
142 | + 'ce' => 'Chechen', |
|
143 | + 'zh' => 'Chinese', |
|
144 | + 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', |
|
145 | + 'cv' => 'Chuvash', |
|
146 | + 'kw' => 'Cornish', |
|
147 | + 'co' => 'Corsican', |
|
148 | + 'cr' => 'Cree', |
|
149 | + 'cs' => 'Czech', |
|
150 | + 'da' => 'Danish', |
|
151 | + 'dv' => 'Divehi; Dhivehi; Maldivian', |
|
152 | + 'nl' => 'Dutch; Flemish', |
|
153 | + 'dz' => 'Dzongkha', |
|
154 | + 'en' => 'English', |
|
155 | + 'eo' => 'Esperanto', |
|
156 | + 'et' => 'Estonian', |
|
157 | + 'ee' => 'Ewe', |
|
158 | + 'fo' => 'Faroese', |
|
159 | + 'fj' => 'Fijjian', |
|
160 | + 'fi' => 'Finnish', |
|
161 | + 'fr' => 'French', |
|
162 | + 'fy' => 'Western Frisian', |
|
163 | + 'ff' => 'Fulah', |
|
164 | + 'ka' => 'Georgian', |
|
165 | + 'de' => 'German', |
|
166 | + 'gd' => 'Gaelic; Scottish Gaelic', |
|
167 | + 'ga' => 'Irish', |
|
168 | + 'gl' => 'Galician', |
|
169 | + 'gv' => 'Manx', |
|
170 | + 'el' => 'Greek, Modern', |
|
171 | + 'gn' => 'Guarani', |
|
172 | + 'gu' => 'Gujarati', |
|
173 | + 'ht' => 'Haitian; Haitian Creole', |
|
174 | + 'ha' => 'Hausa', |
|
175 | + 'he' => 'Hebrew', |
|
176 | + 'hz' => 'Herero', |
|
177 | + 'hi' => 'Hindi', |
|
178 | + 'ho' => 'Hiri Motu', |
|
179 | + 'hu' => 'Hungarian', |
|
180 | + 'ig' => 'Igbo', |
|
181 | + 'is' => 'Icelandic', |
|
182 | + 'io' => 'Ido', |
|
183 | + 'ii' => 'Sichuan Yi', |
|
184 | + 'iu' => 'Inuktitut', |
|
185 | + 'ie' => 'Interlingue', |
|
186 | + 'ia' => 'Interlingua (International Auxiliary Language Association)', |
|
187 | + 'id' => 'Indonesian', |
|
188 | + 'ik' => 'Inupiaq', |
|
189 | + 'it' => 'Italian', |
|
190 | + 'jv' => 'Javanese', |
|
191 | + 'ja' => 'Japanese', |
|
192 | + 'kl' => 'Kalaallisut; Greenlandic', |
|
193 | + 'kn' => 'Kannada', |
|
194 | + 'ks' => 'Kashmiri', |
|
195 | + 'kr' => 'Kanuri', |
|
196 | + 'kk' => 'Kazakh', |
|
197 | + 'km' => 'Central Khmer', |
|
198 | + 'ki' => 'Kikuyu; Gikuyu', |
|
199 | + 'rw' => 'Kinyarwanda', |
|
200 | + 'ky' => 'Kirghiz; Kyrgyz', |
|
201 | + 'kv' => 'Komi', |
|
202 | + 'kg' => 'Kongo', |
|
203 | + 'ko' => 'Korean', |
|
204 | + 'kj' => 'Kuanyama; Kwanyama', |
|
205 | + 'ku' => 'Kurdish', |
|
206 | + 'lo' => 'Lao', |
|
207 | + 'la' => 'Latin', |
|
208 | + 'lv' => 'Latvian', |
|
209 | + 'li' => 'Limburgan; Limburger; Limburgish', |
|
210 | + 'ln' => 'Lingala', |
|
211 | + 'lt' => 'Lithuanian', |
|
212 | + 'lb' => 'Luxembourgish; Letzeburgesch', |
|
213 | + 'lu' => 'Luba-Katanga', |
|
214 | + 'lg' => 'Ganda', |
|
215 | + 'mk' => 'Macedonian', |
|
216 | + 'mh' => 'Marshallese', |
|
217 | + 'ml' => 'Malayalam', |
|
218 | + 'mi' => 'Maori', |
|
219 | + 'mr' => 'Marathi', |
|
220 | + 'ms' => 'Malay', |
|
221 | + 'mg' => 'Malagasy', |
|
222 | + 'mt' => 'Maltese', |
|
223 | + 'mo' => 'Moldavian', |
|
224 | + 'mn' => 'Mongolian', |
|
225 | + 'na' => 'Nauru', |
|
226 | + 'nv' => 'Navajo; Navaho', |
|
227 | + 'nr' => 'Ndebele, South; South Ndebele', |
|
228 | + 'nd' => 'Ndebele, North; North Ndebele', |
|
229 | + 'ng' => 'Ndonga', |
|
230 | + 'ne' => 'Nepali', |
|
231 | + 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', |
|
232 | + 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', |
|
233 | + 'no' => 'Norwegian', |
|
234 | + 'ny' => 'Chichewa; Chewa; Nyanja', |
|
235 | + 'oc' => 'Occitan, Provençal', |
|
236 | + 'oj' => 'Ojibwa', |
|
237 | + 'or' => 'Oriya', |
|
238 | + 'om' => 'Oromo', |
|
239 | + 'os' => 'Ossetian; Ossetic', |
|
240 | + 'pa' => 'Panjabi; Punjabi', |
|
241 | + 'fa' => 'Persian', |
|
242 | + 'pi' => 'Pali', |
|
243 | + 'pl' => 'Polish', |
|
244 | + 'pt' => 'Portuguese', |
|
245 | + 'ps' => 'Pushto', |
|
246 | + 'qu' => 'Quechua', |
|
247 | + 'rm' => 'Romansh', |
|
248 | + 'ro' => 'Romanian', |
|
249 | + 'rn' => 'Rundi', |
|
250 | + 'ru' => 'Russian', |
|
251 | + 'sg' => 'Sango', |
|
252 | + 'sa' => 'Sanskrit', |
|
253 | + 'sr' => 'Serbian', |
|
254 | + 'hr' => 'Croatian', |
|
255 | + 'si' => 'Sinhala; Sinhalese', |
|
256 | + 'sk' => 'Slovak', |
|
257 | + 'sl' => 'Slovenian', |
|
258 | + 'se' => 'Northern Sami', |
|
259 | + 'sm' => 'Samoan', |
|
260 | + 'sn' => 'Shona', |
|
261 | + 'sd' => 'Sindhi', |
|
262 | + 'so' => 'Somali', |
|
263 | + 'st' => 'Sotho, Southern', |
|
264 | + 'es' => 'Spanish; Castilian', |
|
265 | + 'sc' => 'Sardinian', |
|
266 | + 'ss' => 'Swati', |
|
267 | + 'su' => 'Sundanese', |
|
268 | + 'sw' => 'Swahili', |
|
269 | + 'sv' => 'Swedish', |
|
270 | + 'ty' => 'Tahitian', |
|
271 | + 'ta' => 'Tamil', |
|
272 | + 'tt' => 'Tatar', |
|
273 | + 'te' => 'Telugu', |
|
274 | + 'tg' => 'Tajik', |
|
275 | + 'tl' => 'Tagalog', |
|
276 | + 'th' => 'Thai', |
|
277 | + 'bo' => 'Tibetan', |
|
278 | + 'ti' => 'Tigrinya', |
|
279 | + 'to' => 'Tonga (Tonga Islands)', |
|
280 | + 'tn' => 'Tswana', |
|
281 | + 'ts' => 'Tsonga', |
|
282 | + 'tk' => 'Turkmen', |
|
283 | + 'tr' => 'Turkish', |
|
284 | + 'tw' => 'Twi', |
|
285 | + 'ug' => 'Uighur; Uyghur', |
|
286 | + 'uk' => 'Ukrainian', |
|
287 | + 'ur' => 'Urdu', |
|
288 | + 'uz' => 'Uzbek', |
|
289 | + 've' => 'Venda', |
|
290 | + 'vi' => 'Vietnamese', |
|
291 | + 'vo' => 'Volapük', |
|
292 | + 'cy' => 'Welsh', |
|
293 | + 'wa' => 'Walloon', |
|
294 | + 'wo' => 'Wolof', |
|
295 | + 'xh' => 'Xhosa', |
|
296 | + 'yi' => 'Yiddish', |
|
297 | + 'yo' => 'Yoruba', |
|
298 | + 'za' => 'Zhuang; Chuang', |
|
299 | + 'zu' => 'Zulu', |
|
300 | + ); |
|
301 | 301 | |
302 | - /** |
|
303 | - * Filters the language codes. |
|
304 | - * |
|
305 | - * @since MU |
|
306 | - * |
|
307 | - * @param array $lang_codes Key/value pair of language codes where key is the short version. |
|
308 | - * @param string $code A two-letter designation of the language. |
|
309 | - */ |
|
310 | - $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); |
|
302 | + /** |
|
303 | + * Filters the language codes. |
|
304 | + * |
|
305 | + * @since MU |
|
306 | + * |
|
307 | + * @param array $lang_codes Key/value pair of language codes where key is the short version. |
|
308 | + * @param string $code A two-letter designation of the language. |
|
309 | + */ |
|
310 | + $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); |
|
311 | 311 | |
312 | - return strtr( $code, $lang_codes ); |
|
313 | - } |
|
312 | + return strtr( $code, $lang_codes ); |
|
313 | + } |
|
314 | 314 | |
315 | 315 | } |