@@ -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 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
| 36 | 36 | */ |
| 37 | - public function __construct( $entity_service ) { |
|
| 37 | + public function __construct($entity_service) { |
|
| 38 | 38 | |
| 39 | 39 | $this->entity_service = $entity_service; |
| 40 | 40 | |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | * @return array|string|null A single string, or an array of values or null |
| 51 | 51 | * if the property isn't recognized. |
| 52 | 52 | */ |
| 53 | - public function get( $post_id ) { |
|
| 53 | + public function get($post_id) { |
|
| 54 | 54 | |
| 55 | 55 | // get related entities. |
| 56 | - $related = wl_core_get_related_entity_ids( $post_id ); |
|
| 56 | + $related = wl_core_get_related_entity_ids($post_id); |
|
| 57 | 57 | |
| 58 | 58 | // A reference to the entity service. |
| 59 | 59 | $entity_service = $this->entity_service; |
| 60 | 60 | |
| 61 | 61 | // Map the related posts' ids to URIs. |
| 62 | - return array_map( function ( $item ) use ( $entity_service ) { |
|
| 63 | - return $entity_service->get_uri( $item ); |
|
| 64 | - }, $related ); |
|
| 62 | + return array_map(function($item) use ($entity_service) { |
|
| 63 | + return $entity_service->get_uri($item); |
|
| 64 | + }, $related); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
@@ -21,53 +21,53 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class Wordlift_Post_Related_Storage extends Wordlift_Storage { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The {@link Wordlift_Entity_Service} instance. |
|
| 26 | - * |
|
| 27 | - * @since 3.15.0 |
|
| 28 | - * @access private |
|
| 29 | - * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 30 | - */ |
|
| 31 | - private $entity_service; |
|
| 24 | + /** |
|
| 25 | + * The {@link Wordlift_Entity_Service} instance. |
|
| 26 | + * |
|
| 27 | + * @since 3.15.0 |
|
| 28 | + * @access private |
|
| 29 | + * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 30 | + */ |
|
| 31 | + private $entity_service; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Create a {@link Wordlift_Post_Related_Storage} instance. |
|
| 35 | - * |
|
| 36 | - * @since 3.15.0 |
|
| 37 | - * |
|
| 38 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 39 | - */ |
|
| 40 | - public function __construct( $entity_service ) { |
|
| 33 | + /** |
|
| 34 | + * Create a {@link Wordlift_Post_Related_Storage} instance. |
|
| 35 | + * |
|
| 36 | + * @since 3.15.0 |
|
| 37 | + * |
|
| 38 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 39 | + */ |
|
| 40 | + public function __construct( $entity_service ) { |
|
| 41 | 41 | |
| 42 | - $this->entity_service = $entity_service; |
|
| 42 | + $this->entity_service = $entity_service; |
|
| 43 | 43 | |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Get the property value. |
|
| 48 | - * |
|
| 49 | - * There is no filter for entities or posts, the returned data here can |
|
| 50 | - * be used for `relations` and `references` according to the client. |
|
| 51 | - * |
|
| 52 | - * @since 3.15.0 |
|
| 53 | - * |
|
| 54 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 55 | - * |
|
| 56 | - * @return array|string|null A single string, or an array of values or null |
|
| 57 | - * if the property isn't recognized. |
|
| 58 | - */ |
|
| 59 | - public function get( $post_id ) { |
|
| 46 | + /** |
|
| 47 | + * Get the property value. |
|
| 48 | + * |
|
| 49 | + * There is no filter for entities or posts, the returned data here can |
|
| 50 | + * be used for `relations` and `references` according to the client. |
|
| 51 | + * |
|
| 52 | + * @since 3.15.0 |
|
| 53 | + * |
|
| 54 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 55 | + * |
|
| 56 | + * @return array|string|null A single string, or an array of values or null |
|
| 57 | + * if the property isn't recognized. |
|
| 58 | + */ |
|
| 59 | + public function get( $post_id ) { |
|
| 60 | 60 | |
| 61 | - // get related entities. |
|
| 62 | - $related = wl_core_get_related_entity_ids( $post_id ); |
|
| 61 | + // get related entities. |
|
| 62 | + $related = wl_core_get_related_entity_ids( $post_id ); |
|
| 63 | 63 | |
| 64 | - // A reference to the entity service. |
|
| 65 | - $entity_service = $this->entity_service; |
|
| 64 | + // A reference to the entity service. |
|
| 65 | + $entity_service = $this->entity_service; |
|
| 66 | 66 | |
| 67 | - // Map the related posts' ids to URIs. |
|
| 68 | - return array_map( function ( $item ) use ( $entity_service ) { |
|
| 69 | - return $entity_service->get_uri( $item ); |
|
| 70 | - }, $related ); |
|
| 71 | - } |
|
| 67 | + // Map the related posts' ids to URIs. |
|
| 68 | + return array_map( function ( $item ) use ( $entity_service ) { |
|
| 69 | + return $entity_service->get_uri( $item ); |
|
| 70 | + }, $related ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | } |
@@ -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 | |
@@ -4,26 +4,26 @@ |
||
| 4 | 4 | */ |
| 5 | 5 | class Wordlift_Sanitizer { |
| 6 | 6 | |
| 7 | - /** |
|
| 8 | - * Only accept URIs |
|
| 9 | - * |
|
| 10 | - * @param string $value |
|
| 11 | - * |
|
| 12 | - * @return null |
|
| 13 | - */ |
|
| 14 | - public static function sanitize_url( $value ) { |
|
| 7 | + /** |
|
| 8 | + * Only accept URIs |
|
| 9 | + * |
|
| 10 | + * @param string $value |
|
| 11 | + * |
|
| 12 | + * @return null |
|
| 13 | + */ |
|
| 14 | + public static function sanitize_url( $value ) { |
|
| 15 | 15 | |
| 16 | - // Initially this function used also filter_var( $value, FILTER_VALIDATE_URL ) |
|
| 17 | - // but URLs with UTF-8 characters are not valid. We store those anyway in the DB as it's up to the browser |
|
| 18 | - // to do proper url encoding when requesting the URL. |
|
| 19 | - // |
|
| 20 | - // see also http://stackoverflow.com/questions/2137080/php-filter-var-filter-validate-url |
|
| 16 | + // Initially this function used also filter_var( $value, FILTER_VALIDATE_URL ) |
|
| 17 | + // but URLs with UTF-8 characters are not valid. We store those anyway in the DB as it's up to the browser |
|
| 18 | + // to do proper url encoding when requesting the URL. |
|
| 19 | + // |
|
| 20 | + // see also http://stackoverflow.com/questions/2137080/php-filter-var-filter-validate-url |
|
| 21 | 21 | |
| 22 | - if ( ! is_null( $value ) && $value !== '' ) { |
|
| 23 | - return $value; |
|
| 24 | - } |
|
| 22 | + if ( ! is_null( $value ) && $value !== '' ) { |
|
| 23 | + return $value; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - return null; |
|
| 27 | - } |
|
| 26 | + return null; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @return null |
| 13 | 13 | */ |
| 14 | - public static function sanitize_url( $value ) { |
|
| 14 | + public static function sanitize_url($value) { |
|
| 15 | 15 | |
| 16 | 16 | // Initially this function used also filter_var( $value, FILTER_VALIDATE_URL ) |
| 17 | 17 | // but URLs with UTF-8 characters are not valid. We store those anyway in the DB as it's up to the browser |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | // |
| 20 | 20 | // see also http://stackoverflow.com/questions/2137080/php-filter-var-filter-validate-url |
| 21 | 21 | |
| 22 | - if ( ! is_null( $value ) && $value !== '' ) { |
|
| 22 | + if ( ! is_null($value) && $value !== '') { |
|
| 23 | 23 | return $value; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -39,16 +39,16 @@ |
||
| 39 | 39 | |
| 40 | 40 | <!-- Show the 'JSON-LD' button only if the constant is defined and set to true. --> |
| 41 | 41 | <?php |
| 42 | - if ( |
|
| 43 | - defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) && |
|
| 44 | - WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA |
|
| 45 | - ) : |
|
| 46 | - $class_name = 'button wl-add-input wl-button'; |
|
| 47 | - |
|
| 48 | - if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) { |
|
| 49 | - $class_name .= ' wl-button-disabled'; |
|
| 50 | - } |
|
| 51 | - ?> |
|
| 42 | + if ( |
|
| 43 | + defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) && |
|
| 44 | + WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA |
|
| 45 | + ) : |
|
| 46 | + $class_name = 'button wl-add-input wl-button'; |
|
| 47 | + |
|
| 48 | + if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) { |
|
| 49 | + $class_name .= ' wl-button-disabled'; |
|
| 50 | + } |
|
| 51 | + ?> |
|
| 52 | 52 | <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_google_analytics_export' ) ); ?>" |
| 53 | 53 | class="<?php echo esc_attr( $class_name ); ?>"> |
| 54 | 54 | <?php esc_html_e( 'Google Analytics', 'wordlift' ); ?> |
@@ -14,46 +14,46 @@ |
||
| 14 | 14 | <!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 15 | 15 | |
| 16 | 16 | <div class="wrap"> |
| 17 | - <h2><?php echo esc_html_x( 'Download Your Data', 'Page title', 'wordlift' ); ?></h2> |
|
| 18 | - <p><?php esc_html_e( 'Choose the format to download your data:', 'wordlift' ); ?></p> |
|
| 17 | + <h2><?php echo esc_html_x('Download Your Data', 'Page title', 'wordlift'); ?></h2> |
|
| 18 | + <p><?php esc_html_e('Choose the format to download your data:', 'wordlift'); ?></p> |
|
| 19 | 19 | |
| 20 | - <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=json' ) ); ?>" |
|
| 20 | + <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=json')); ?>" |
|
| 21 | 21 | class="button wl-add-input wl-button"> |
| 22 | - <?php esc_html_e( 'JSON-LD', 'wordlift' ); ?> |
|
| 22 | + <?php esc_html_e('JSON-LD', 'wordlift'); ?> |
|
| 23 | 23 | </a> |
| 24 | 24 | |
| 25 | - <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=rdf' ) ); ?>" |
|
| 25 | + <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=rdf')); ?>" |
|
| 26 | 26 | class="button wl-add-input wl-button"> |
| 27 | - <?php esc_html_e( 'RDF/XML', 'wordlift' ); ?> |
|
| 27 | + <?php esc_html_e('RDF/XML', 'wordlift'); ?> |
|
| 28 | 28 | </a> |
| 29 | 29 | |
| 30 | - <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=ttl' ) ); ?>" |
|
| 30 | + <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=ttl')); ?>" |
|
| 31 | 31 | class="button wl-add-input wl-button"> |
| 32 | - <?php echo esc_html_x( 'Turtle', 'File format, not the animal', 'wordlift' ); ?> |
|
| 32 | + <?php echo esc_html_x('Turtle', 'File format, not the animal', 'wordlift'); ?> |
|
| 33 | 33 | </a> |
| 34 | 34 | |
| 35 | - <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_your_data&out=n3' ) ); ?>" |
|
| 35 | + <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_your_data&out=n3')); ?>" |
|
| 36 | 36 | class="button wl-add-input wl-button"> |
| 37 | - <?php esc_html_e( 'N3', 'wordlift' ); ?> |
|
| 37 | + <?php esc_html_e('N3', 'wordlift'); ?> |
|
| 38 | 38 | </a> |
| 39 | 39 | |
| 40 | 40 | <!-- Show the 'JSON-LD' button only if the constant is defined and set to true. --> |
| 41 | 41 | <?php |
| 42 | 42 | if ( |
| 43 | - defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) && |
|
| 43 | + defined('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA') && |
|
| 44 | 44 | WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA |
| 45 | 45 | ) : |
| 46 | 46 | $class_name = 'button wl-add-input wl-button'; |
| 47 | 47 | |
| 48 | - if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) { |
|
| 48 | + if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure()) { |
|
| 49 | 49 | $class_name .= ' wl-button-disabled'; |
| 50 | 50 | } |
| 51 | 51 | ?> |
| 52 | - <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_google_analytics_export' ) ); ?>" |
|
| 53 | - class="<?php echo esc_attr( $class_name ); ?>"> |
|
| 54 | - <?php esc_html_e( 'Google Analytics', 'wordlift' ); ?> |
|
| 52 | + <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_google_analytics_export')); ?>" |
|
| 53 | + class="<?php echo esc_attr($class_name); ?>"> |
|
| 54 | + <?php esc_html_e('Google Analytics', 'wordlift'); ?> |
|
| 55 | 55 | |
| 56 | - <?php if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure() ) : ?> |
|
| 56 | + <?php if ( ! Wordlift_Google_Analytics_Export_Service::is_postname_permalink_structure()) : ?> |
|
| 57 | 57 | <span class="wl-tooltip">To download your data, please change <br /> the site permalink structure to "Post name"</span> |
| 58 | 58 | <?php endif ?> |
| 59 | 59 | </a> |
@@ -18,104 +18,104 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Google_Analytics_Export_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Export the site data that could be imported in Google Analytics. |
|
| 23 | - * It will works only when permalink structure is set to "Postname". |
|
| 24 | - * |
|
| 25 | - * @since 3.16.0 |
|
| 26 | - * |
|
| 27 | - * @return void |
|
| 28 | - */ |
|
| 29 | - public function export() { |
|
| 30 | - // Bail if the permalink structure is different from "Post name". |
|
| 31 | - if ( ! $this->is_postname_permalink_structure() ) { |
|
| 32 | - wp_die( 'The current permalink structure do not allow to export your data. Please change the permalink structure to "Post name".' ); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - // Output the file data. @codingStandardsIgnoreLine |
|
| 36 | - @ob_end_clean(); |
|
| 37 | - |
|
| 38 | - // Generate unique filename using current timestamp. |
|
| 39 | - $filename = 'wl-ga-export-' . date( 'Y-m-d-H-i-s' ) . '.csv'; |
|
| 40 | - |
|
| 41 | - // Add proper file headers. |
|
| 42 | - header( "Content-Disposition: attachment; filename=$filename" ); |
|
| 43 | - header( 'Content-Type: text/csv; charset=' . get_bloginfo( 'charset' ) ); |
|
| 44 | - |
|
| 45 | - // Do not cache the file. |
|
| 46 | - header( 'Pragma: no-cache' ); |
|
| 47 | - header( 'Expires: 0' ); |
|
| 48 | - |
|
| 49 | - // Build the CSV file. |
|
| 50 | - $this->create_csv(); |
|
| 51 | - |
|
| 52 | - wp_die(); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Return site path. Some installations are in subdirectories |
|
| 57 | - * and we need add them to expported permalinks. |
|
| 58 | - * |
|
| 59 | - * @since 3.16.0 |
|
| 60 | - * |
|
| 61 | - * @return string The site path. |
|
| 62 | - */ |
|
| 63 | - public function get_site_path() { |
|
| 64 | - // Get home url from database. |
|
| 65 | - $home_url = home_url( '/' ); |
|
| 66 | - |
|
| 67 | - // Parse the url. |
|
| 68 | - $parsed = wp_parse_url( $home_url ); |
|
| 69 | - |
|
| 70 | - // Return the path. |
|
| 71 | - return $parsed['path']; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Check if the current permalink structure is set to "Post name". |
|
| 77 | - * |
|
| 78 | - * @since 3.16.0 |
|
| 79 | - * |
|
| 80 | - * @return bool whether the structure is "Post name" or not. |
|
| 81 | - */ |
|
| 82 | - public static function is_postname_permalink_structure() { |
|
| 83 | - // Get current permalink structure. |
|
| 84 | - $structure = get_option( 'permalink_structure' ); |
|
| 85 | - |
|
| 86 | - // The regular expression. It will check if the site structure contains postname. |
|
| 87 | - $regex = '~^/\%postname\%/$~'; |
|
| 88 | - |
|
| 89 | - // Check if the site structure match the rquired one. |
|
| 90 | - preg_match( $regex, $structure, $matches ); |
|
| 91 | - |
|
| 92 | - // Bail if the site have different structure. |
|
| 93 | - if ( empty( $matches ) ) { |
|
| 94 | - return false; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - return true; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Generate array data, that should be exported as csv. |
|
| 102 | - * The data contains the post/page title, entity name and type. |
|
| 103 | - * |
|
| 104 | - * @since 3.16.0 |
|
| 105 | - * |
|
| 106 | - * @return array $items Content data. |
|
| 107 | - */ |
|
| 108 | - public function get_content_data() { |
|
| 109 | - // Get the global $wpdb. |
|
| 110 | - global $wpdb; |
|
| 111 | - |
|
| 112 | - // Site path (optional). |
|
| 113 | - $path = $this->get_site_path(); |
|
| 114 | - |
|
| 115 | - // Get the data. |
|
| 116 | - $items = $wpdb->get_results( |
|
| 117 | - $wpdb->prepare( |
|
| 118 | - "SELECT |
|
| 21 | + /** |
|
| 22 | + * Export the site data that could be imported in Google Analytics. |
|
| 23 | + * It will works only when permalink structure is set to "Postname". |
|
| 24 | + * |
|
| 25 | + * @since 3.16.0 |
|
| 26 | + * |
|
| 27 | + * @return void |
|
| 28 | + */ |
|
| 29 | + public function export() { |
|
| 30 | + // Bail if the permalink structure is different from "Post name". |
|
| 31 | + if ( ! $this->is_postname_permalink_structure() ) { |
|
| 32 | + wp_die( 'The current permalink structure do not allow to export your data. Please change the permalink structure to "Post name".' ); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + // Output the file data. @codingStandardsIgnoreLine |
|
| 36 | + @ob_end_clean(); |
|
| 37 | + |
|
| 38 | + // Generate unique filename using current timestamp. |
|
| 39 | + $filename = 'wl-ga-export-' . date( 'Y-m-d-H-i-s' ) . '.csv'; |
|
| 40 | + |
|
| 41 | + // Add proper file headers. |
|
| 42 | + header( "Content-Disposition: attachment; filename=$filename" ); |
|
| 43 | + header( 'Content-Type: text/csv; charset=' . get_bloginfo( 'charset' ) ); |
|
| 44 | + |
|
| 45 | + // Do not cache the file. |
|
| 46 | + header( 'Pragma: no-cache' ); |
|
| 47 | + header( 'Expires: 0' ); |
|
| 48 | + |
|
| 49 | + // Build the CSV file. |
|
| 50 | + $this->create_csv(); |
|
| 51 | + |
|
| 52 | + wp_die(); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Return site path. Some installations are in subdirectories |
|
| 57 | + * and we need add them to expported permalinks. |
|
| 58 | + * |
|
| 59 | + * @since 3.16.0 |
|
| 60 | + * |
|
| 61 | + * @return string The site path. |
|
| 62 | + */ |
|
| 63 | + public function get_site_path() { |
|
| 64 | + // Get home url from database. |
|
| 65 | + $home_url = home_url( '/' ); |
|
| 66 | + |
|
| 67 | + // Parse the url. |
|
| 68 | + $parsed = wp_parse_url( $home_url ); |
|
| 69 | + |
|
| 70 | + // Return the path. |
|
| 71 | + return $parsed['path']; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Check if the current permalink structure is set to "Post name". |
|
| 77 | + * |
|
| 78 | + * @since 3.16.0 |
|
| 79 | + * |
|
| 80 | + * @return bool whether the structure is "Post name" or not. |
|
| 81 | + */ |
|
| 82 | + public static function is_postname_permalink_structure() { |
|
| 83 | + // Get current permalink structure. |
|
| 84 | + $structure = get_option( 'permalink_structure' ); |
|
| 85 | + |
|
| 86 | + // The regular expression. It will check if the site structure contains postname. |
|
| 87 | + $regex = '~^/\%postname\%/$~'; |
|
| 88 | + |
|
| 89 | + // Check if the site structure match the rquired one. |
|
| 90 | + preg_match( $regex, $structure, $matches ); |
|
| 91 | + |
|
| 92 | + // Bail if the site have different structure. |
|
| 93 | + if ( empty( $matches ) ) { |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + return true; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Generate array data, that should be exported as csv. |
|
| 102 | + * The data contains the post/page title, entity name and type. |
|
| 103 | + * |
|
| 104 | + * @since 3.16.0 |
|
| 105 | + * |
|
| 106 | + * @return array $items Content data. |
|
| 107 | + */ |
|
| 108 | + public function get_content_data() { |
|
| 109 | + // Get the global $wpdb. |
|
| 110 | + global $wpdb; |
|
| 111 | + |
|
| 112 | + // Site path (optional). |
|
| 113 | + $path = $this->get_site_path(); |
|
| 114 | + |
|
| 115 | + // Get the data. |
|
| 116 | + $items = $wpdb->get_results( |
|
| 117 | + $wpdb->prepare( |
|
| 118 | + "SELECT |
|
| 119 | 119 | CONCAT( '%s', p.post_name, '/' ) AS 'post_name', |
| 120 | 120 | p1.post_name AS 'entity_name', |
| 121 | 121 | t.slug AS 'entity_type' |
@@ -132,43 +132,43 @@ discard block |
||
| 132 | 132 | INNER JOIN {$wpdb->prefix}terms t |
| 133 | 133 | ON t.term_id = tt.term_id |
| 134 | 134 | WHERE p.post_type IN ( 'page', 'post' );", |
| 135 | - $path |
|
| 136 | - ) |
|
| 137 | - ); // db call ok; no-cache ok. |
|
| 138 | - |
|
| 139 | - return $items; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Create the CSV file that will be downloaded. |
|
| 144 | - * |
|
| 145 | - * @since 3.16.0 |
|
| 146 | - * |
|
| 147 | - * @return void |
|
| 148 | - */ |
|
| 149 | - public function create_csv() { |
|
| 150 | - // Create a file pointer connected to the output stream. |
|
| 151 | - // Ignoring linter notices below that complain about file output which do not actually happen. |
|
| 152 | - $file = fopen( 'php://output', 'w' ); |
|
| 153 | - |
|
| 154 | - // Add the column headers. @codingStandardsIgnoreLine |
|
| 155 | - fputcsv( |
|
| 156 | - $file, |
|
| 157 | - array( |
|
| 158 | - 'ga:pagePath', |
|
| 159 | - 'ga:dimension1', |
|
| 160 | - 'ga:dimension2', |
|
| 161 | - ) |
|
| 162 | - ); |
|
| 163 | - |
|
| 164 | - // Cycle through items and add each item data to the file. |
|
| 165 | - foreach ( $this->get_content_data() as $row ) { |
|
| 166 | - // Add new line in the file. @codingStandardsIgnoreLine |
|
| 167 | - fputcsv( |
|
| 168 | - $file, |
|
| 169 | - (array) $row // convert the object to array. |
|
| 170 | - ); |
|
| 171 | - } |
|
| 172 | - } |
|
| 135 | + $path |
|
| 136 | + ) |
|
| 137 | + ); // db call ok; no-cache ok. |
|
| 138 | + |
|
| 139 | + return $items; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Create the CSV file that will be downloaded. |
|
| 144 | + * |
|
| 145 | + * @since 3.16.0 |
|
| 146 | + * |
|
| 147 | + * @return void |
|
| 148 | + */ |
|
| 149 | + public function create_csv() { |
|
| 150 | + // Create a file pointer connected to the output stream. |
|
| 151 | + // Ignoring linter notices below that complain about file output which do not actually happen. |
|
| 152 | + $file = fopen( 'php://output', 'w' ); |
|
| 153 | + |
|
| 154 | + // Add the column headers. @codingStandardsIgnoreLine |
|
| 155 | + fputcsv( |
|
| 156 | + $file, |
|
| 157 | + array( |
|
| 158 | + 'ga:pagePath', |
|
| 159 | + 'ga:dimension1', |
|
| 160 | + 'ga:dimension2', |
|
| 161 | + ) |
|
| 162 | + ); |
|
| 163 | + |
|
| 164 | + // Cycle through items and add each item data to the file. |
|
| 165 | + foreach ( $this->get_content_data() as $row ) { |
|
| 166 | + // Add new line in the file. @codingStandardsIgnoreLine |
|
| 167 | + fputcsv( |
|
| 168 | + $file, |
|
| 169 | + (array) $row // convert the object to array. |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | } |
@@ -28,23 +28,23 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function export() { |
| 30 | 30 | // Bail if the permalink structure is different from "Post name". |
| 31 | - if ( ! $this->is_postname_permalink_structure() ) { |
|
| 32 | - wp_die( 'The current permalink structure do not allow to export your data. Please change the permalink structure to "Post name".' ); |
|
| 31 | + if ( ! $this->is_postname_permalink_structure()) { |
|
| 32 | + wp_die('The current permalink structure do not allow to export your data. Please change the permalink structure to "Post name".'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Output the file data. @codingStandardsIgnoreLine |
| 36 | 36 | @ob_end_clean(); |
| 37 | 37 | |
| 38 | 38 | // Generate unique filename using current timestamp. |
| 39 | - $filename = 'wl-ga-export-' . date( 'Y-m-d-H-i-s' ) . '.csv'; |
|
| 39 | + $filename = 'wl-ga-export-'.date('Y-m-d-H-i-s').'.csv'; |
|
| 40 | 40 | |
| 41 | 41 | // Add proper file headers. |
| 42 | - header( "Content-Disposition: attachment; filename=$filename" ); |
|
| 43 | - header( 'Content-Type: text/csv; charset=' . get_bloginfo( 'charset' ) ); |
|
| 42 | + header("Content-Disposition: attachment; filename=$filename"); |
|
| 43 | + header('Content-Type: text/csv; charset='.get_bloginfo('charset')); |
|
| 44 | 44 | |
| 45 | 45 | // Do not cache the file. |
| 46 | - header( 'Pragma: no-cache' ); |
|
| 47 | - header( 'Expires: 0' ); |
|
| 46 | + header('Pragma: no-cache'); |
|
| 47 | + header('Expires: 0'); |
|
| 48 | 48 | |
| 49 | 49 | // Build the CSV file. |
| 50 | 50 | $this->create_csv(); |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function get_site_path() { |
| 64 | 64 | // Get home url from database. |
| 65 | - $home_url = home_url( '/' ); |
|
| 65 | + $home_url = home_url('/'); |
|
| 66 | 66 | |
| 67 | 67 | // Parse the url. |
| 68 | - $parsed = wp_parse_url( $home_url ); |
|
| 68 | + $parsed = wp_parse_url($home_url); |
|
| 69 | 69 | |
| 70 | 70 | // Return the path. |
| 71 | 71 | return $parsed['path']; |
@@ -81,16 +81,16 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public static function is_postname_permalink_structure() { |
| 83 | 83 | // Get current permalink structure. |
| 84 | - $structure = get_option( 'permalink_structure' ); |
|
| 84 | + $structure = get_option('permalink_structure'); |
|
| 85 | 85 | |
| 86 | 86 | // The regular expression. It will check if the site structure contains postname. |
| 87 | 87 | $regex = '~^/\%postname\%/$~'; |
| 88 | 88 | |
| 89 | 89 | // Check if the site structure match the rquired one. |
| 90 | - preg_match( $regex, $structure, $matches ); |
|
| 90 | + preg_match($regex, $structure, $matches); |
|
| 91 | 91 | |
| 92 | 92 | // Bail if the site have different structure. |
| 93 | - if ( empty( $matches ) ) { |
|
| 93 | + if (empty($matches)) { |
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public function create_csv() { |
| 150 | 150 | // Create a file pointer connected to the output stream. |
| 151 | 151 | // Ignoring linter notices below that complain about file output which do not actually happen. |
| 152 | - $file = fopen( 'php://output', 'w' ); |
|
| 152 | + $file = fopen('php://output', 'w'); |
|
| 153 | 153 | |
| 154 | 154 | // Add the column headers. @codingStandardsIgnoreLine |
| 155 | 155 | fputcsv( |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | 164 | // Cycle through items and add each item data to the file. |
| 165 | - foreach ( $this->get_content_data() as $row ) { |
|
| 165 | + foreach ($this->get_content_data() as $row) { |
|
| 166 | 166 | // Add new line in the file. @codingStandardsIgnoreLine |
| 167 | 167 | fputcsv( |
| 168 | 168 | $file, |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | public static function activate() { |
| 32 | 32 | |
| 33 | 33 | // Do not let the plugin be activate on WordPress versions before 4.4. |
| 34 | - $version = get_bloginfo( 'version' ); |
|
| 35 | - if ( version_compare( $version, '4.4', '<' ) ) { |
|
| 36 | - die( esc_html__( 'The WordLift plugin requires WordPress version 4.4 or above.', 'wordlift' ) ); |
|
| 34 | + $version = get_bloginfo('version'); |
|
| 35 | + if (version_compare($version, '4.4', '<')) { |
|
| 36 | + die(esc_html__('The WordLift plugin requires WordPress version 4.4 or above.', 'wordlift')); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $configuration_service = Wordlift_Configuration_Service::get_instance(); |
| 40 | 40 | |
| 41 | 41 | // Create a blank application key if there is none. |
| 42 | 42 | $key = $configuration_service->get_key(); |
| 43 | - if ( empty( $key ) ) { |
|
| 44 | - $configuration_service->set_key( '' ); |
|
| 43 | + if (empty($key)) { |
|
| 44 | + $configuration_service->set_key(''); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Intentionally go through the whole upgrade procedure to be DRY. |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // If WordLift's key is not configured, set `_wl_activation_redirect` transient. We won't redirect here, because we can't give |
| 53 | 53 | // for granted that we're in a browser admin session. |
| 54 | - if ( '' === $configuration_service->get_key() ) { |
|
| 55 | - set_transient( '_wl_activation_redirect', true, 30 ); |
|
| 54 | + if ('' === $configuration_service->get_key()) { |
|
| 55 | + set_transient('_wl_activation_redirect', true, 30); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Clear caches. |
@@ -21,44 +21,44 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class Wordlift_Activator { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Short Description. (use period) |
|
| 26 | - * |
|
| 27 | - * Long Description. |
|
| 28 | - * |
|
| 29 | - * @since 1.0.0 |
|
| 30 | - */ |
|
| 31 | - public static function activate() { |
|
| 24 | + /** |
|
| 25 | + * Short Description. (use period) |
|
| 26 | + * |
|
| 27 | + * Long Description. |
|
| 28 | + * |
|
| 29 | + * @since 1.0.0 |
|
| 30 | + */ |
|
| 31 | + public static function activate() { |
|
| 32 | 32 | |
| 33 | - // Do not let the plugin be activate on WordPress versions before 4.4. |
|
| 34 | - $version = get_bloginfo( 'version' ); |
|
| 35 | - if ( version_compare( $version, '4.4', '<' ) ) { |
|
| 36 | - die( esc_html__( 'The WordLift plugin requires WordPress version 4.4 or above.', 'wordlift' ) ); |
|
| 37 | - } |
|
| 33 | + // Do not let the plugin be activate on WordPress versions before 4.4. |
|
| 34 | + $version = get_bloginfo( 'version' ); |
|
| 35 | + if ( version_compare( $version, '4.4', '<' ) ) { |
|
| 36 | + die( esc_html__( 'The WordLift plugin requires WordPress version 4.4 or above.', 'wordlift' ) ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 39 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 40 | 40 | |
| 41 | - // Create a blank application key if there is none. |
|
| 42 | - $key = $configuration_service->get_key(); |
|
| 41 | + // Create a blank application key if there is none. |
|
| 42 | + $key = $configuration_service->get_key(); |
|
| 43 | 43 | |
| 44 | - if ( empty( $key ) ) { |
|
| 45 | - $configuration_service->set_key( '' ); |
|
| 46 | - } |
|
| 44 | + if ( empty( $key ) ) { |
|
| 45 | + $configuration_service->set_key( '' ); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - // Intentionally go through the whole upgrade procedure to be DRY. |
|
| 49 | - // The following function is called also from `init` so it's not necessary |
|
| 50 | - // here. |
|
| 51 | - // wl_core_update_db_check. |
|
| 48 | + // Intentionally go through the whole upgrade procedure to be DRY. |
|
| 49 | + // The following function is called also from `init` so it's not necessary |
|
| 50 | + // here. |
|
| 51 | + // wl_core_update_db_check. |
|
| 52 | 52 | |
| 53 | - // If WordLift's key is not configured, set `_wl_activation_redirect` transient. We won't redirect here, because we can't give |
|
| 54 | - // for granted that we're in a browser admin session. |
|
| 55 | - if ( '' === $configuration_service->get_key() ) { |
|
| 56 | - set_transient( '_wl_activation_redirect', true, 30 ); |
|
| 57 | - } |
|
| 53 | + // If WordLift's key is not configured, set `_wl_activation_redirect` transient. We won't redirect here, because we can't give |
|
| 54 | + // for granted that we're in a browser admin session. |
|
| 55 | + if ( '' === $configuration_service->get_key() ) { |
|
| 56 | + set_transient( '_wl_activation_redirect', true, 30 ); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - // Clear caches. |
|
| 60 | - Wordlift_File_Cache_Service::flush_all(); |
|
| 59 | + // Clear caches. |
|
| 60 | + Wordlift_File_Cache_Service::flush_all(); |
|
| 61 | 61 | |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
@@ -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 | } |
@@ -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( |
@@ -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 | } |