@@ -16,26 +16,26 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | abstract class Wordlift_Widget extends WP_Widget { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @inheritdoc |
|
| 21 | - */ |
|
| 22 | - public function __construct( $id_base, $name, array $widget_options = array(), array $control_options = array() ) { |
|
| 23 | - parent::__construct( $id_base, $name, $widget_options, $control_options ); |
|
| 19 | + /** |
|
| 20 | + * @inheritdoc |
|
| 21 | + */ |
|
| 22 | + public function __construct( $id_base, $name, array $widget_options = array(), array $control_options = array() ) { |
|
| 23 | + parent::__construct( $id_base, $name, $widget_options, $control_options ); |
|
| 24 | 24 | |
| 25 | - // Initialize the Related Entities Cloud Widget. |
|
| 26 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
| 25 | + // Initialize the Related Entities Cloud Widget. |
|
| 26 | + add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
| 27 | 27 | |
| 28 | - } |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Register the related entities cloud widget |
|
| 32 | - * |
|
| 33 | - * @since 3.11.0 |
|
| 34 | - */ |
|
| 35 | - public function widget_init() { |
|
| 30 | + /** |
|
| 31 | + * Register the related entities cloud widget |
|
| 32 | + * |
|
| 33 | + * @since 3.11.0 |
|
| 34 | + */ |
|
| 35 | + public function widget_init() { |
|
| 36 | 36 | |
| 37 | - register_widget( get_class( $this ) ); |
|
| 37 | + register_widget( get_class( $this ) ); |
|
| 38 | 38 | |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * @inheritdoc |
| 21 | 21 | */ |
| 22 | - public function __construct( $id_base, $name, array $widget_options = array(), array $control_options = array() ) { |
|
| 23 | - parent::__construct( $id_base, $name, $widget_options, $control_options ); |
|
| 22 | + public function __construct($id_base, $name, array $widget_options = array(), array $control_options = array()) { |
|
| 23 | + parent::__construct($id_base, $name, $widget_options, $control_options); |
|
| 24 | 24 | |
| 25 | 25 | // Initialize the Related Entities Cloud Widget. |
| 26 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
| 26 | + add_action('widgets_init', array($this, 'widget_init')); |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function widget_init() { |
| 36 | 36 | |
| 37 | - register_widget( get_class( $this ) ); |
|
| 37 | + register_widget(get_class($this)); |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
@@ -18,63 +18,63 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Post_Author_Storage extends Wordlift_Post_Property_Storage { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The {@link Wordlift_Entity_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.15.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $entity_service; |
|
| 21 | + /** |
|
| 22 | + * The {@link Wordlift_Entity_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.15.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $entity_service; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * The {@link Wordlift_User_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.15.0 |
|
| 34 | - * @access private |
|
| 35 | - * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private $user_service; |
|
| 30 | + /** |
|
| 31 | + * The {@link Wordlift_User_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.15.0 |
|
| 34 | + * @access private |
|
| 35 | + * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private $user_service; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Create a {@link Wordlift_Post_Author_Storage} instance. |
|
| 41 | - * |
|
| 42 | - * @since 3.15.0 |
|
| 43 | - * |
|
| 44 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 45 | - * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 46 | - */ |
|
| 47 | - public function __construct( $entity_service, $user_service ) { |
|
| 48 | - parent::__construct( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 39 | + /** |
|
| 40 | + * Create a {@link Wordlift_Post_Author_Storage} instance. |
|
| 41 | + * |
|
| 42 | + * @since 3.15.0 |
|
| 43 | + * |
|
| 44 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 45 | + * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 46 | + */ |
|
| 47 | + public function __construct( $entity_service, $user_service ) { |
|
| 48 | + parent::__construct( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 49 | 49 | |
| 50 | - $this->entity_service = $entity_service; |
|
| 51 | - $this->user_service = $user_service; |
|
| 50 | + $this->entity_service = $entity_service; |
|
| 51 | + $this->user_service = $user_service; |
|
| 52 | 52 | |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Get the property value. |
|
| 57 | - * |
|
| 58 | - * @since 3.15.0 |
|
| 59 | - * |
|
| 60 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 61 | - * |
|
| 62 | - * @return array|string|null A single string, or an array of values or null |
|
| 63 | - * if the property isn't recognized. |
|
| 64 | - */ |
|
| 65 | - public function get( $post_id ) { |
|
| 66 | - $author_id = parent::get( $post_id ); |
|
| 55 | + /** |
|
| 56 | + * Get the property value. |
|
| 57 | + * |
|
| 58 | + * @since 3.15.0 |
|
| 59 | + * |
|
| 60 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 61 | + * |
|
| 62 | + * @return array|string|null A single string, or an array of values or null |
|
| 63 | + * if the property isn't recognized. |
|
| 64 | + */ |
|
| 65 | + public function get( $post_id ) { |
|
| 66 | + $author_id = parent::get( $post_id ); |
|
| 67 | 67 | |
| 68 | - // Get the entity bound to this user. |
|
| 69 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 68 | + // Get the entity bound to this user. |
|
| 69 | + $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 70 | 70 | |
| 71 | - // If there's no entity bound return a simple author structure. |
|
| 72 | - if ( empty( $entity_id ) ) { |
|
| 73 | - return $this->user_service->get_uri( $author_id ); |
|
| 74 | - } |
|
| 71 | + // If there's no entity bound return a simple author structure. |
|
| 72 | + if ( empty( $entity_id ) ) { |
|
| 73 | + return $this->user_service->get_uri( $author_id ); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - // Return the entity URI. |
|
| 77 | - return $this->entity_service->get_uri( $entity_id ); |
|
| 78 | - } |
|
| 76 | + // Return the entity URI. |
|
| 77 | + return $this->entity_service->get_uri( $entity_id ); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | } |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
| 45 | 45 | * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
| 46 | 46 | */ |
| 47 | - public function __construct( $entity_service, $user_service ) { |
|
| 48 | - parent::__construct( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 47 | + public function __construct($entity_service, $user_service) { |
|
| 48 | + parent::__construct(Wordlift_Post_Property_Storage::AUTHOR); |
|
| 49 | 49 | |
| 50 | 50 | $this->entity_service = $entity_service; |
| 51 | 51 | $this->user_service = $user_service; |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | * @return array|string|null A single string, or an array of values or null |
| 63 | 63 | * if the property isn't recognized. |
| 64 | 64 | */ |
| 65 | - public function get( $post_id ) { |
|
| 66 | - $author_id = parent::get( $post_id ); |
|
| 65 | + public function get($post_id) { |
|
| 66 | + $author_id = parent::get($post_id); |
|
| 67 | 67 | |
| 68 | 68 | // Get the entity bound to this user. |
| 69 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 69 | + $entity_id = $this->user_service->get_entity($author_id); |
|
| 70 | 70 | |
| 71 | 71 | // If there's no entity bound return a simple author structure. |
| 72 | - if ( empty( $entity_id ) ) { |
|
| 73 | - return $this->user_service->get_uri( $author_id ); |
|
| 72 | + if (empty($entity_id)) { |
|
| 73 | + return $this->user_service->get_uri($author_id); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Return the entity URI. |
| 77 | - return $this->entity_service->get_uri( $entity_id ); |
|
| 77 | + return $this->entity_service->get_uri($entity_id); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | } |
@@ -18,41 +18,41 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Post_Meta_Storage extends Wordlift_Storage { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The meta key to load data from. |
|
| 23 | - * |
|
| 24 | - * @since 3.15.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var string $meta_key The meta key to load data from. |
|
| 27 | - */ |
|
| 28 | - private $meta_key; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Create a {@link Wordlift_Post_Meta_Storage} instance, by providing the |
|
| 32 | - * meta key the storage should read from. |
|
| 33 | - * |
|
| 34 | - * @since 3.15.0 |
|
| 35 | - * |
|
| 36 | - * @param string $meta_key The post meta key. |
|
| 37 | - */ |
|
| 38 | - public function __construct( $meta_key ) { |
|
| 39 | - |
|
| 40 | - $this->meta_key = $meta_key; |
|
| 41 | - |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Get the value for the specified meta key. |
|
| 46 | - * |
|
| 47 | - * @since 3.15.0 |
|
| 48 | - * |
|
| 49 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 50 | - * |
|
| 51 | - * @return array An array of values (or an empty array if nothing is set). |
|
| 52 | - */ |
|
| 53 | - public function get( $post_id ) { |
|
| 54 | - |
|
| 55 | - return get_post_meta( $post_id, $this->meta_key ); |
|
| 56 | - } |
|
| 21 | + /** |
|
| 22 | + * The meta key to load data from. |
|
| 23 | + * |
|
| 24 | + * @since 3.15.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var string $meta_key The meta key to load data from. |
|
| 27 | + */ |
|
| 28 | + private $meta_key; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Create a {@link Wordlift_Post_Meta_Storage} instance, by providing the |
|
| 32 | + * meta key the storage should read from. |
|
| 33 | + * |
|
| 34 | + * @since 3.15.0 |
|
| 35 | + * |
|
| 36 | + * @param string $meta_key The post meta key. |
|
| 37 | + */ |
|
| 38 | + public function __construct( $meta_key ) { |
|
| 39 | + |
|
| 40 | + $this->meta_key = $meta_key; |
|
| 41 | + |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Get the value for the specified meta key. |
|
| 46 | + * |
|
| 47 | + * @since 3.15.0 |
|
| 48 | + * |
|
| 49 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 50 | + * |
|
| 51 | + * @return array An array of values (or an empty array if nothing is set). |
|
| 52 | + */ |
|
| 53 | + public function get( $post_id ) { |
|
| 54 | + |
|
| 55 | + return get_post_meta( $post_id, $this->meta_key ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param string $meta_key The post meta key. |
| 37 | 37 | */ |
| 38 | - public function __construct( $meta_key ) { |
|
| 38 | + public function __construct($meta_key) { |
|
| 39 | 39 | |
| 40 | 40 | $this->meta_key = $meta_key; |
| 41 | 41 | |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return array An array of values (or an empty array if nothing is set). |
| 52 | 52 | */ |
| 53 | - public function get( $post_id ) { |
|
| 53 | + public function get($post_id) { |
|
| 54 | 54 | |
| 55 | - return get_post_meta( $post_id, $this->meta_key ); |
|
| 55 | + return get_post_meta($post_id, $this->meta_key); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } |
@@ -16,35 +16,35 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | abstract class Wordlift_Storage { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Get the values for the property of the {@link WP_Post}. |
|
| 21 | - * |
|
| 22 | - * @since 3.15.0 |
|
| 23 | - * |
|
| 24 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 25 | - * |
|
| 26 | - * @return array |
|
| 27 | - */ |
|
| 28 | - abstract public function get( $post_id ); |
|
| 19 | + /** |
|
| 20 | + * Get the values for the property of the {@link WP_Post}. |
|
| 21 | + * |
|
| 22 | + * @since 3.15.0 |
|
| 23 | + * |
|
| 24 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 25 | + * |
|
| 26 | + * @return array |
|
| 27 | + */ |
|
| 28 | + abstract public function get( $post_id ); |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Get the first value for a property. |
|
| 32 | - * |
|
| 33 | - * @since 3.15.0 |
|
| 34 | - * |
|
| 35 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 36 | - * |
|
| 37 | - * @return string The first property value or an empty string. |
|
| 38 | - */ |
|
| 39 | - public function get_first( $post_id ) { |
|
| 30 | + /** |
|
| 31 | + * Get the first value for a property. |
|
| 32 | + * |
|
| 33 | + * @since 3.15.0 |
|
| 34 | + * |
|
| 35 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 36 | + * |
|
| 37 | + * @return string The first property value or an empty string. |
|
| 38 | + */ |
|
| 39 | + public function get_first( $post_id ) { |
|
| 40 | 40 | |
| 41 | - $values = $this->get( $post_id ); |
|
| 41 | + $values = $this->get( $post_id ); |
|
| 42 | 42 | |
| 43 | - if ( empty( $values ) ) { |
|
| 44 | - return ''; |
|
| 45 | - } |
|
| 43 | + if ( empty( $values ) ) { |
|
| 44 | + return ''; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $values[0]; |
|
| 48 | - } |
|
| 47 | + return $values[0]; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return array |
| 27 | 27 | */ |
| 28 | - abstract public function get( $post_id ); |
|
| 28 | + abstract public function get($post_id); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Get the first value for a property. |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return string The first property value or an empty string. |
| 38 | 38 | */ |
| 39 | - public function get_first( $post_id ) { |
|
| 39 | + public function get_first($post_id) { |
|
| 40 | 40 | |
| 41 | - $values = $this->get( $post_id ); |
|
| 41 | + $values = $this->get($post_id); |
|
| 42 | 42 | |
| 43 | - if ( empty( $values ) ) { |
|
| 43 | + if (empty($values)) { |
|
| 44 | 44 | return ''; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return array The letters array or an empty array if the language isn't supported. |
| 28 | 28 | */ |
| 29 | - public static function get( $language_code ) { |
|
| 29 | + public static function get($language_code) { |
|
| 30 | 30 | |
| 31 | - switch ( $language_code ) { |
|
| 31 | + switch ($language_code) { |
|
| 32 | 32 | case '': |
| 33 | 33 | case 'en': |
| 34 | 34 | case 'fr': |
@@ -40,97 +40,97 @@ discard block |
||
| 40 | 40 | case 'pt': |
| 41 | 41 | case 'uk': |
| 42 | 42 | case 'zh-cn': |
| 43 | - return self::reset( range( 'A', 'Z' ) ); |
|
| 43 | + return self::reset(range('A', 'Z')); |
|
| 44 | 44 | |
| 45 | 45 | case 'be': |
| 46 | 46 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/be_utf8/langconfig.php . |
| 47 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я' ) ); |
|
| 47 | + return self::reset(explode(',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я')); |
|
| 48 | 48 | |
| 49 | 49 | case 'no': |
| 50 | 50 | case 'da': |
| 51 | 51 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/nn_utf8/langconfig.php . |
| 52 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å' ) ); |
|
| 52 | + return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å')); |
|
| 53 | 53 | |
| 54 | 54 | case 'bg': |
| 55 | 55 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/bg_utf8/langconfig.php . |
| 56 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я' ) ); |
|
| 56 | + return self::reset(explode(',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я')); |
|
| 57 | 57 | |
| 58 | 58 | case 'cs': |
| 59 | 59 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/cs_utf8/langconfig.php . |
| 60 | - return self::reset( explode( ',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž' ) ); |
|
| 60 | + return self::reset(explode(',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž')); |
|
| 61 | 61 | |
| 62 | 62 | case 'es': |
| 63 | 63 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/es_utf8/langconfig.php . |
| 64 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z' ) ); |
|
| 64 | + return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z')); |
|
| 65 | 65 | |
| 66 | 66 | case 'et': |
| 67 | 67 | // @see https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet . |
| 68 | - return self::reset( explode( ',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü' ) ); |
|
| 68 | + return self::reset(explode(',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü')); |
|
| 69 | 69 | |
| 70 | 70 | case 'fi': |
| 71 | 71 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/fi_utf8/langconfig.php . |
| 72 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) ); |
|
| 72 | + return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö')); |
|
| 73 | 73 | |
| 74 | 74 | case 'hr': |
| 75 | 75 | // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
| 76 | - return self::reset( explode( ',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž' ) ); |
|
| 76 | + return self::reset(explode(',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž')); |
|
| 77 | 77 | |
| 78 | 78 | case 'hu': |
| 79 | 79 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/hu_utf8/langconfig.php . |
| 80 | - return self::reset( explode( ',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS' ) ); |
|
| 80 | + return self::reset(explode(',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS')); |
|
| 81 | 81 | |
| 82 | 82 | case 'is': |
| 83 | 83 | // @see https://en.wikipedia.org/wiki/Icelandic_orthography . |
| 84 | - return self::reset( explode( ',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö' ) ); |
|
| 84 | + return self::reset(explode(',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö')); |
|
| 85 | 85 | |
| 86 | 86 | case 'lt': |
| 87 | 87 | // @see https://en.wikipedia.org/wiki/Lithuanian_orthography#Alphabet . |
| 88 | - return self::reset( explode( ',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž' ) ); |
|
| 88 | + return self::reset(explode(',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž')); |
|
| 89 | 89 | |
| 90 | 90 | case 'lv': |
| 91 | 91 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/lv_utf8/langconfig.php . |
| 92 | - return self::reset( explode( ',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž' ) ); |
|
| 92 | + return self::reset(explode(',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž')); |
|
| 93 | 93 | |
| 94 | 94 | case 'pl': |
| 95 | 95 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/pl_utf8/langconfig.php . |
| 96 | - return self::reset( explode( ',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż' ) ); |
|
| 96 | + return self::reset(explode(',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż')); |
|
| 97 | 97 | |
| 98 | 98 | case 'ro': |
| 99 | 99 | // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
| 100 | - return self::reset( explode( ',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z' ) ); |
|
| 100 | + return self::reset(explode(',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z')); |
|
| 101 | 101 | |
| 102 | 102 | case 'ru': |
| 103 | 103 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/ru_utf8/langconfig.php . |
| 104 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я' ) ); |
|
| 104 | + return self::reset(explode(',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я')); |
|
| 105 | 105 | |
| 106 | 106 | case 'sk': |
| 107 | 107 | // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
| 108 | - return self::reset( explode( ',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž' ) ); |
|
| 108 | + return self::reset(explode(',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž')); |
|
| 109 | 109 | |
| 110 | 110 | case 'sl': |
| 111 | 111 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sl_utf8/langconfig.php . |
| 112 | - return self::reset( explode( ',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž' ) ); |
|
| 112 | + return self::reset(explode(',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž')); |
|
| 113 | 113 | |
| 114 | 114 | case 'sq': |
| 115 | 115 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sq_utf8/langconfig.php . |
| 116 | - return self::reset( explode( ',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH' ) ); |
|
| 116 | + return self::reset(explode(',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH')); |
|
| 117 | 117 | |
| 118 | 118 | case 'sr': |
| 119 | 119 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sr_cr_utf8/langconfig.php . |
| 120 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш' ) ); |
|
| 120 | + return self::reset(explode(',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш')); |
|
| 121 | 121 | |
| 122 | 122 | case 'sv': |
| 123 | 123 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sv_utf8/langconfig.php . |
| 124 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) ); |
|
| 124 | + return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö')); |
|
| 125 | 125 | |
| 126 | 126 | case 'tr': |
| 127 | 127 | // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/tr_utf8/langconfig.php . |
| 128 | - return self::reset( explode( ',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X' ) ); |
|
| 128 | + return self::reset(explode(',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X')); |
|
| 129 | 129 | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // If we got here, we don't support the language, then return an empty array. |
| 133 | - return self::reset( array() ); |
|
| 133 | + return self::reset(array()); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return array The alphabet array with letters as keys and empty arrays as values. |
| 144 | 144 | */ |
| 145 | - private static function reset( $alphabet ) { |
|
| 145 | + private static function reset($alphabet) { |
|
| 146 | 146 | |
| 147 | - $letters = array_flip( $alphabet ); |
|
| 147 | + $letters = array_flip($alphabet); |
|
| 148 | 148 | |
| 149 | - foreach ( $letters as $key => $value ) { |
|
| 150 | - $letters[ $key ] = array(); |
|
| 149 | + foreach ($letters as $key => $value) { |
|
| 150 | + $letters[$key] = array(); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return $letters + array( |
@@ -17,142 +17,142 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Wordlift_Alphabet_Service { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Get the alphabet for the specified language code. |
|
| 22 | - * |
|
| 23 | - * @since 3.17.0 |
|
| 24 | - * |
|
| 25 | - * @param string $language_code A two-letter language code. |
|
| 26 | - * |
|
| 27 | - * @return array The letters array or an empty array if the language isn't supported. |
|
| 28 | - */ |
|
| 29 | - public static function get( $language_code ) { |
|
| 30 | - |
|
| 31 | - switch ( $language_code ) { |
|
| 32 | - case '': |
|
| 33 | - case 'en': |
|
| 34 | - case 'fr': |
|
| 35 | - case 'de': |
|
| 36 | - case 'ca': |
|
| 37 | - case 'nl': |
|
| 38 | - case 'id': |
|
| 39 | - case 'it': |
|
| 40 | - case 'pt': |
|
| 41 | - case 'uk': |
|
| 42 | - case 'zh-cn': |
|
| 43 | - return self::reset( range( 'A', 'Z' ) ); |
|
| 44 | - |
|
| 45 | - case 'be': |
|
| 46 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/be_utf8/langconfig.php . |
|
| 47 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я' ) ); |
|
| 48 | - |
|
| 49 | - case 'no': |
|
| 50 | - case 'da': |
|
| 51 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/nn_utf8/langconfig.php . |
|
| 52 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å' ) ); |
|
| 53 | - |
|
| 54 | - case 'bg': |
|
| 55 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/bg_utf8/langconfig.php . |
|
| 56 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я' ) ); |
|
| 57 | - |
|
| 58 | - case 'cs': |
|
| 59 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/cs_utf8/langconfig.php . |
|
| 60 | - return self::reset( explode( ',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž' ) ); |
|
| 61 | - |
|
| 62 | - case 'es': |
|
| 63 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/es_utf8/langconfig.php . |
|
| 64 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z' ) ); |
|
| 65 | - |
|
| 66 | - case 'et': |
|
| 67 | - // @see https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet . |
|
| 68 | - return self::reset( explode( ',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü' ) ); |
|
| 69 | - |
|
| 70 | - case 'fi': |
|
| 71 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/fi_utf8/langconfig.php . |
|
| 72 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) ); |
|
| 73 | - |
|
| 74 | - case 'hr': |
|
| 75 | - // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
|
| 76 | - return self::reset( explode( ',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž' ) ); |
|
| 77 | - |
|
| 78 | - case 'hu': |
|
| 79 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/hu_utf8/langconfig.php . |
|
| 80 | - return self::reset( explode( ',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS' ) ); |
|
| 81 | - |
|
| 82 | - case 'is': |
|
| 83 | - // @see https://en.wikipedia.org/wiki/Icelandic_orthography . |
|
| 84 | - return self::reset( explode( ',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö' ) ); |
|
| 85 | - |
|
| 86 | - case 'lt': |
|
| 87 | - // @see https://en.wikipedia.org/wiki/Lithuanian_orthography#Alphabet . |
|
| 88 | - return self::reset( explode( ',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž' ) ); |
|
| 89 | - |
|
| 90 | - case 'lv': |
|
| 91 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/lv_utf8/langconfig.php . |
|
| 92 | - return self::reset( explode( ',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž' ) ); |
|
| 93 | - |
|
| 94 | - case 'pl': |
|
| 95 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/pl_utf8/langconfig.php . |
|
| 96 | - return self::reset( explode( ',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż' ) ); |
|
| 97 | - |
|
| 98 | - case 'ro': |
|
| 99 | - // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
|
| 100 | - return self::reset( explode( ',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z' ) ); |
|
| 101 | - |
|
| 102 | - case 'ru': |
|
| 103 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/ru_utf8/langconfig.php . |
|
| 104 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я' ) ); |
|
| 105 | - |
|
| 106 | - case 'sk': |
|
| 107 | - // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
|
| 108 | - return self::reset( explode( ',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž' ) ); |
|
| 109 | - |
|
| 110 | - case 'sl': |
|
| 111 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sl_utf8/langconfig.php . |
|
| 112 | - return self::reset( explode( ',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž' ) ); |
|
| 113 | - |
|
| 114 | - case 'sq': |
|
| 115 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sq_utf8/langconfig.php . |
|
| 116 | - return self::reset( explode( ',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH' ) ); |
|
| 117 | - |
|
| 118 | - case 'sr': |
|
| 119 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sr_cr_utf8/langconfig.php . |
|
| 120 | - return self::reset( explode( ',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш' ) ); |
|
| 121 | - |
|
| 122 | - case 'sv': |
|
| 123 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sv_utf8/langconfig.php . |
|
| 124 | - return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) ); |
|
| 125 | - |
|
| 126 | - case 'tr': |
|
| 127 | - // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/tr_utf8/langconfig.php . |
|
| 128 | - return self::reset( explode( ',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X' ) ); |
|
| 129 | - |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - // If we got here, we don't support the language, then return an empty array. |
|
| 133 | - return self::reset( array() ); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Reset the alphabet array by assigning an empty array to each key. |
|
| 138 | - * |
|
| 139 | - * @since 3.17.0 |
|
| 140 | - * |
|
| 141 | - * @param array $alphabet The alphabet array. |
|
| 142 | - * |
|
| 143 | - * @return array The alphabet array with letters as keys and empty arrays as values. |
|
| 144 | - */ |
|
| 145 | - private static function reset( $alphabet ) { |
|
| 146 | - |
|
| 147 | - $letters = array_flip( $alphabet ); |
|
| 148 | - |
|
| 149 | - foreach ( $letters as $key => $value ) { |
|
| 150 | - $letters[ $key ] = array(); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - return $letters + array( |
|
| 154 | - '#' => array(), |
|
| 155 | - ); |
|
| 156 | - } |
|
| 20 | + /** |
|
| 21 | + * Get the alphabet for the specified language code. |
|
| 22 | + * |
|
| 23 | + * @since 3.17.0 |
|
| 24 | + * |
|
| 25 | + * @param string $language_code A two-letter language code. |
|
| 26 | + * |
|
| 27 | + * @return array The letters array or an empty array if the language isn't supported. |
|
| 28 | + */ |
|
| 29 | + public static function get( $language_code ) { |
|
| 30 | + |
|
| 31 | + switch ( $language_code ) { |
|
| 32 | + case '': |
|
| 33 | + case 'en': |
|
| 34 | + case 'fr': |
|
| 35 | + case 'de': |
|
| 36 | + case 'ca': |
|
| 37 | + case 'nl': |
|
| 38 | + case 'id': |
|
| 39 | + case 'it': |
|
| 40 | + case 'pt': |
|
| 41 | + case 'uk': |
|
| 42 | + case 'zh-cn': |
|
| 43 | + return self::reset( range( 'A', 'Z' ) ); |
|
| 44 | + |
|
| 45 | + case 'be': |
|
| 46 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/be_utf8/langconfig.php . |
|
| 47 | + return self::reset( explode( ',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я' ) ); |
|
| 48 | + |
|
| 49 | + case 'no': |
|
| 50 | + case 'da': |
|
| 51 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/nn_utf8/langconfig.php . |
|
| 52 | + return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å' ) ); |
|
| 53 | + |
|
| 54 | + case 'bg': |
|
| 55 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/bg_utf8/langconfig.php . |
|
| 56 | + return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я' ) ); |
|
| 57 | + |
|
| 58 | + case 'cs': |
|
| 59 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/cs_utf8/langconfig.php . |
|
| 60 | + return self::reset( explode( ',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž' ) ); |
|
| 61 | + |
|
| 62 | + case 'es': |
|
| 63 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/es_utf8/langconfig.php . |
|
| 64 | + return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z' ) ); |
|
| 65 | + |
|
| 66 | + case 'et': |
|
| 67 | + // @see https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet . |
|
| 68 | + return self::reset( explode( ',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü' ) ); |
|
| 69 | + |
|
| 70 | + case 'fi': |
|
| 71 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/fi_utf8/langconfig.php . |
|
| 72 | + return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) ); |
|
| 73 | + |
|
| 74 | + case 'hr': |
|
| 75 | + // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
|
| 76 | + return self::reset( explode( ',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž' ) ); |
|
| 77 | + |
|
| 78 | + case 'hu': |
|
| 79 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/hu_utf8/langconfig.php . |
|
| 80 | + return self::reset( explode( ',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS' ) ); |
|
| 81 | + |
|
| 82 | + case 'is': |
|
| 83 | + // @see https://en.wikipedia.org/wiki/Icelandic_orthography . |
|
| 84 | + return self::reset( explode( ',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö' ) ); |
|
| 85 | + |
|
| 86 | + case 'lt': |
|
| 87 | + // @see https://en.wikipedia.org/wiki/Lithuanian_orthography#Alphabet . |
|
| 88 | + return self::reset( explode( ',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž' ) ); |
|
| 89 | + |
|
| 90 | + case 'lv': |
|
| 91 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/lv_utf8/langconfig.php . |
|
| 92 | + return self::reset( explode( ',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž' ) ); |
|
| 93 | + |
|
| 94 | + case 'pl': |
|
| 95 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/pl_utf8/langconfig.php . |
|
| 96 | + return self::reset( explode( ',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż' ) ); |
|
| 97 | + |
|
| 98 | + case 'ro': |
|
| 99 | + // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
|
| 100 | + return self::reset( explode( ',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z' ) ); |
|
| 101 | + |
|
| 102 | + case 'ru': |
|
| 103 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/ru_utf8/langconfig.php . |
|
| 104 | + return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я' ) ); |
|
| 105 | + |
|
| 106 | + case 'sk': |
|
| 107 | + // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py . |
|
| 108 | + return self::reset( explode( ',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž' ) ); |
|
| 109 | + |
|
| 110 | + case 'sl': |
|
| 111 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sl_utf8/langconfig.php . |
|
| 112 | + return self::reset( explode( ',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž' ) ); |
|
| 113 | + |
|
| 114 | + case 'sq': |
|
| 115 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sq_utf8/langconfig.php . |
|
| 116 | + return self::reset( explode( ',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH' ) ); |
|
| 117 | + |
|
| 118 | + case 'sr': |
|
| 119 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sr_cr_utf8/langconfig.php . |
|
| 120 | + return self::reset( explode( ',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш' ) ); |
|
| 121 | + |
|
| 122 | + case 'sv': |
|
| 123 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sv_utf8/langconfig.php . |
|
| 124 | + return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) ); |
|
| 125 | + |
|
| 126 | + case 'tr': |
|
| 127 | + // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/tr_utf8/langconfig.php . |
|
| 128 | + return self::reset( explode( ',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X' ) ); |
|
| 129 | + |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + // If we got here, we don't support the language, then return an empty array. |
|
| 133 | + return self::reset( array() ); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Reset the alphabet array by assigning an empty array to each key. |
|
| 138 | + * |
|
| 139 | + * @since 3.17.0 |
|
| 140 | + * |
|
| 141 | + * @param array $alphabet The alphabet array. |
|
| 142 | + * |
|
| 143 | + * @return array The alphabet array with letters as keys and empty arrays as values. |
|
| 144 | + */ |
|
| 145 | + private static function reset( $alphabet ) { |
|
| 146 | + |
|
| 147 | + $letters = array_flip( $alphabet ); |
|
| 148 | + |
|
| 149 | + foreach ( $letters as $key => $value ) { |
|
| 150 | + $letters[ $key ] = array(); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + return $letters + array( |
|
| 154 | + '#' => array(), |
|
| 155 | + ); |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | } |
@@ -21,18 +21,18 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class Wordlift_Deactivator { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Short Description. (use period) |
|
| 26 | - * |
|
| 27 | - * Long Description. |
|
| 28 | - * |
|
| 29 | - * @since 1.0.0 |
|
| 30 | - */ |
|
| 31 | - public static function deactivate() { |
|
| 24 | + /** |
|
| 25 | + * Short Description. (use period) |
|
| 26 | + * |
|
| 27 | + * Long Description. |
|
| 28 | + * |
|
| 29 | + * @since 1.0.0 |
|
| 30 | + */ |
|
| 31 | + public static function deactivate() { |
|
| 32 | 32 | |
| 33 | - // Clear caches. |
|
| 34 | - Wordlift_File_Cache_Service::flush_all(); |
|
| 33 | + // Clear caches. |
|
| 34 | + Wordlift_File_Cache_Service::flush_all(); |
|
| 35 | 35 | |
| 36 | - } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | } |
@@ -18,15 +18,15 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | interface Wordlift_Admin_Element { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Render the element. |
|
| 23 | - * |
|
| 24 | - * @since 3.11.0 |
|
| 25 | - * |
|
| 26 | - * @param array $args An array of parameters. |
|
| 27 | - * |
|
| 28 | - * @return \Wordlift_Admin_Element The element instance. |
|
| 29 | - */ |
|
| 30 | - public function render( $args ); |
|
| 21 | + /** |
|
| 22 | + * Render the element. |
|
| 23 | + * |
|
| 24 | + * @since 3.11.0 |
|
| 25 | + * |
|
| 26 | + * @param array $args An array of parameters. |
|
| 27 | + * |
|
| 28 | + * @return \Wordlift_Admin_Element The element instance. |
|
| 29 | + */ |
|
| 30 | + public function render( $args ); |
|
| 31 | 31 | |
| 32 | 32 | } |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @return \Wordlift_Admin_Element The element instance. |
| 29 | 29 | */ |
| 30 | - public function render( $args ); |
|
| 30 | + public function render($args); |
|
| 31 | 31 | |
| 32 | 32 | } |
@@ -26,10 +26,10 @@ |
||
| 26 | 26 | public function install() { |
| 27 | 27 | |
| 28 | 28 | // Check whether the `article` term exists. |
| 29 | - $article = get_term_by( 'slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 29 | + $article = get_term_by('slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
| 30 | 30 | |
| 31 | 31 | // The `article` term doesn't exists, so create it. |
| 32 | - if ( empty( $article ) ) { |
|
| 32 | + if (empty($article)) { |
|
| 33 | 33 | wp_insert_term( |
| 34 | 34 | 'Article', |
| 35 | 35 | Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
@@ -16,30 +16,30 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Install_3_15_0 extends Wordlift_Install { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @inheritdoc |
|
| 21 | - */ |
|
| 22 | - protected static $version = '3.15.0'; |
|
| 19 | + /** |
|
| 20 | + * @inheritdoc |
|
| 21 | + */ |
|
| 22 | + protected static $version = '3.15.0'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @inheritdoc |
|
| 26 | - */ |
|
| 27 | - public function install() { |
|
| 24 | + /** |
|
| 25 | + * @inheritdoc |
|
| 26 | + */ |
|
| 27 | + public function install() { |
|
| 28 | 28 | |
| 29 | - // Check whether the `article` term exists. |
|
| 30 | - $article = get_term_by( 'slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 29 | + // Check whether the `article` term exists. |
|
| 30 | + $article = get_term_by( 'slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 31 | 31 | |
| 32 | - // The `article` term doesn't exists, so create it. |
|
| 33 | - if ( empty( $article ) ) { |
|
| 34 | - wp_insert_term( |
|
| 35 | - 'Article', |
|
| 36 | - Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 37 | - array( |
|
| 38 | - 'slug' => 'article', |
|
| 39 | - 'description' => 'An Article.', |
|
| 40 | - ) |
|
| 41 | - ); |
|
| 42 | - } |
|
| 43 | - } |
|
| 32 | + // The `article` term doesn't exists, so create it. |
|
| 33 | + if ( empty( $article ) ) { |
|
| 34 | + wp_insert_term( |
|
| 35 | + 'Article', |
|
| 36 | + Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 37 | + array( |
|
| 38 | + 'slug' => 'article', |
|
| 39 | + 'description' => 'An Article.', |
|
| 40 | + ) |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | } |
@@ -15,41 +15,41 @@ |
||
| 15 | 15 | * @subpackage Wordlift/install |
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Install_3_10_0 extends Wordlift_Install { |
| 18 | - /** |
|
| 19 | - * @inheritdoc |
|
| 20 | - */ |
|
| 21 | - protected static $version = '3.10.0'; |
|
| 18 | + /** |
|
| 19 | + * @inheritdoc |
|
| 20 | + */ |
|
| 21 | + protected static $version = '3.10.0'; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @inheritdoc |
|
| 25 | - */ |
|
| 26 | - public function install() { |
|
| 23 | + /** |
|
| 24 | + * @inheritdoc |
|
| 25 | + */ |
|
| 26 | + public function install() { |
|
| 27 | 27 | |
| 28 | - $term_slugs = array( |
|
| 29 | - 'thing', |
|
| 30 | - 'creative-work', |
|
| 31 | - 'event', |
|
| 32 | - 'organization', |
|
| 33 | - 'person', |
|
| 34 | - 'place', |
|
| 35 | - 'localbusiness', |
|
| 36 | - ); |
|
| 28 | + $term_slugs = array( |
|
| 29 | + 'thing', |
|
| 30 | + 'creative-work', |
|
| 31 | + 'event', |
|
| 32 | + 'organization', |
|
| 33 | + 'person', |
|
| 34 | + 'place', |
|
| 35 | + 'localbusiness', |
|
| 36 | + ); |
|
| 37 | 37 | |
| 38 | - foreach ( $term_slugs as $slug ) { |
|
| 38 | + foreach ( $term_slugs as $slug ) { |
|
| 39 | 39 | |
| 40 | - $term = get_term_by( 'slug', $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 40 | + $term = get_term_by( 'slug', $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 41 | 41 | |
| 42 | - // Set the term's parent to 0. |
|
| 43 | - if ( $term ) { |
|
| 44 | - wp_update_term( |
|
| 45 | - $term->term_id, |
|
| 46 | - Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 47 | - array( |
|
| 48 | - 'parent' => 0, |
|
| 49 | - ) |
|
| 50 | - ); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 42 | + // Set the term's parent to 0. |
|
| 43 | + if ( $term ) { |
|
| 44 | + wp_update_term( |
|
| 45 | + $term->term_id, |
|
| 46 | + Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 47 | + array( |
|
| 48 | + 'parent' => 0, |
|
| 49 | + ) |
|
| 50 | + ); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | } |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | 'localbusiness', |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - foreach ( $term_slugs as $slug ) { |
|
| 38 | + foreach ($term_slugs as $slug) { |
|
| 39 | 39 | |
| 40 | - $term = get_term_by( 'slug', $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 40 | + $term = get_term_by('slug', $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
| 41 | 41 | |
| 42 | 42 | // Set the term's parent to 0. |
| 43 | - if ( $term ) { |
|
| 43 | + if ($term) { |
|
| 44 | 44 | wp_update_term( |
| 45 | 45 | $term->term_id, |
| 46 | 46 | Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |