@@ -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,61 +18,61 @@ |
||
| 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; |
|
| 52 | - } |
|
| 50 | + $this->entity_service = $entity_service; |
|
| 51 | + $this->user_service = $user_service; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get the property value. |
|
| 56 | - * |
|
| 57 | - * @since 3.15.0 |
|
| 58 | - * |
|
| 59 | - * @param int $post_id The {@link WP_Post}'s id. |
|
| 60 | - * |
|
| 61 | - * @return array|string|null A single string, or an array of values or null |
|
| 62 | - * if the property isn't recognized. |
|
| 63 | - */ |
|
| 64 | - public function get( $post_id ) { |
|
| 65 | - $author_id = parent::get( $post_id ); |
|
| 54 | + /** |
|
| 55 | + * Get the property value. |
|
| 56 | + * |
|
| 57 | + * @since 3.15.0 |
|
| 58 | + * |
|
| 59 | + * @param int $post_id The {@link WP_Post}'s id. |
|
| 60 | + * |
|
| 61 | + * @return array|string|null A single string, or an array of values or null |
|
| 62 | + * if the property isn't recognized. |
|
| 63 | + */ |
|
| 64 | + public function get( $post_id ) { |
|
| 65 | + $author_id = parent::get( $post_id ); |
|
| 66 | 66 | |
| 67 | - // Get the entity bound to this user. |
|
| 68 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 67 | + // Get the entity bound to this user. |
|
| 68 | + $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 69 | 69 | |
| 70 | - // If there's no entity bound return a simple author structure. |
|
| 71 | - if ( empty( $entity_id ) ) { |
|
| 72 | - return $this->user_service->get_uri( $author_id ); |
|
| 73 | - } |
|
| 70 | + // If there's no entity bound return a simple author structure. |
|
| 71 | + if ( empty( $entity_id ) ) { |
|
| 72 | + return $this->user_service->get_uri( $author_id ); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - // Return the entity URI. |
|
| 76 | - return $this->entity_service->get_uri( $entity_id ); |
|
| 77 | - } |
|
| 75 | + // Return the entity URI. |
|
| 76 | + return $this->entity_service->get_uri( $entity_id ); |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -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 | } |
@@ -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, |
@@ -18,210 +18,210 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Storage_Factory { |
| 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; |
|
| 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; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * The {@link Wordlift_Property_Getter} instance. |
|
| 41 | - * |
|
| 42 | - * @since 3.15.0 |
|
| 43 | - * @access private |
|
| 44 | - * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} instance. |
|
| 45 | - */ |
|
| 46 | - private $property_getter; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * The singleton instance. |
|
| 50 | - * |
|
| 51 | - * @since 3.15.0 |
|
| 52 | - * @access private |
|
| 53 | - * @var \Wordlift_Storage_Factory $instance The singleton instance. |
|
| 54 | - */ |
|
| 55 | - private static $instance; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Create a {@link Wordlift_Storage_Factory} instance. |
|
| 59 | - * |
|
| 60 | - * @since 3.15.0 |
|
| 61 | - * |
|
| 62 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 63 | - * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 64 | - * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} instance. |
|
| 65 | - */ |
|
| 66 | - public function __construct( $entity_service, $user_service, $property_getter ) { |
|
| 67 | - |
|
| 68 | - $this->entity_service = $entity_service; |
|
| 69 | - $this->user_service = $user_service; |
|
| 70 | - $this->property_getter = $property_getter; |
|
| 71 | - |
|
| 72 | - self::$instance = $this; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Get the singleton instance. |
|
| 77 | - * |
|
| 78 | - * @since 3.15.0 |
|
| 79 | - * |
|
| 80 | - * @return \Wordlift_Storage_Factory The singleton instance. |
|
| 81 | - */ |
|
| 82 | - public static function get_instance() { |
|
| 83 | - |
|
| 84 | - return self::$instance; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 89 | - * titles. |
|
| 90 | - * |
|
| 91 | - * @since 3.15.0 |
|
| 92 | - * |
|
| 93 | - * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 94 | - * instance. |
|
| 95 | - */ |
|
| 96 | - public function post_title() { |
|
| 97 | - |
|
| 98 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::TITLE ); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 103 | - * descriptions stripped of tags and shortcodes. |
|
| 104 | - * |
|
| 105 | - * @since 3.15.0 |
|
| 106 | - * |
|
| 107 | - * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 108 | - * instance. |
|
| 109 | - */ |
|
| 110 | - public function post_description_no_tags_no_shortcodes() { |
|
| 111 | - |
|
| 112 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES ); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 117 | - * authors. |
|
| 118 | - * |
|
| 119 | - * @since 3.15.0 |
|
| 120 | - * |
|
| 121 | - * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 122 | - * instance. |
|
| 123 | - */ |
|
| 124 | - public function post_author() { |
|
| 125 | - |
|
| 126 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 131 | - * metas. |
|
| 132 | - * |
|
| 133 | - * @since 3.15.0 |
|
| 134 | - * |
|
| 135 | - * @param string $meta_key The meta key to read. |
|
| 136 | - * |
|
| 137 | - * @return Wordlift_Post_Meta_Storage A {@link Wordlift_Post_Meta_Storage} |
|
| 138 | - * instance. |
|
| 139 | - */ |
|
| 140 | - public function post_meta( $meta_key ) { |
|
| 141 | - |
|
| 142 | - return new Wordlift_Post_Meta_Storage( $meta_key ); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Get a {@link Wordlift_Post_Schema_Class_Storage} to read {@link WP_Post}s' |
|
| 147 | - * entity type class. |
|
| 148 | - * |
|
| 149 | - * @since 3.15.0 |
|
| 150 | - * |
|
| 151 | - * @return Wordlift_Post_Schema_Class_Storage A {@link Wordlift_Post_Schema_Class_Storage} |
|
| 152 | - * instance. |
|
| 153 | - */ |
|
| 154 | - public function schema_class() { |
|
| 155 | - |
|
| 156 | - return new Wordlift_Post_Schema_Class_Storage(); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Get a {@link Wordlift_Post_Author_Storage} instance able to turn an author |
|
| 161 | - * id into a URI. |
|
| 162 | - * |
|
| 163 | - * @since 3.15.0 |
|
| 164 | - * |
|
| 165 | - * @return \Wordlift_Post_Author_Storage A {@link Wordlift_Post_Author_Storage} |
|
| 166 | - * instance. |
|
| 167 | - */ |
|
| 168 | - public function author_uri() { |
|
| 169 | - |
|
| 170 | - return new Wordlift_Post_Author_Storage( $this->entity_service, $this->user_service ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Get a {@link Wordlift_Post_Meta_Uri_Storage} instance which reads {@link WP_Post} |
|
| 175 | - * ids and maps them to URI. |
|
| 176 | - * |
|
| 177 | - * @param string $meta_key The {@link WP_Post}'s meta key. |
|
| 178 | - * |
|
| 179 | - * @return \Wordlift_Post_Meta_Uri_Storage A {@link Wordlift_Post_Meta_Uri_Storage} |
|
| 180 | - * instance. |
|
| 181 | - */ |
|
| 182 | - public function post_meta_to_uri( $meta_key ) { |
|
| 183 | - |
|
| 184 | - return new Wordlift_Post_Meta_Uri_Storage( $meta_key, $this->entity_service ); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Get a list of {@link WP_Post}'s images URI. |
|
| 189 | - * |
|
| 190 | - * @since 3.15.0 |
|
| 191 | - * |
|
| 192 | - * @return \Wordlift_Post_Image_Storage A {@link Wordlift_Post_Image_Storage} |
|
| 193 | - * instance. |
|
| 194 | - */ |
|
| 195 | - public function post_images() { |
|
| 196 | - |
|
| 197 | - return new Wordlift_Post_Image_Storage(); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Get a {@link Wordlift_Post_Related_Storage} instance to get related |
|
| 202 | - * {@link WP_Post}s. |
|
| 203 | - * |
|
| 204 | - * @since 3.15.0 |
|
| 205 | - * |
|
| 206 | - * @return \Wordlift_Post_Related_Storage A {@link Wordlift_Post_Related_Storage} |
|
| 207 | - * instance. |
|
| 208 | - */ |
|
| 209 | - public function relations() { |
|
| 210 | - |
|
| 211 | - return new Wordlift_Post_Related_Storage( $this->entity_service ); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * Get the {@link Wordlift_Url_Property_Storage} instance. |
|
| 216 | - * |
|
| 217 | - * @since 3.15.0 |
|
| 218 | - * |
|
| 219 | - * @return \Wordlift_Url_Property_Storage The {@link Wordlift_Url_Property_Storage} |
|
| 220 | - * instance. |
|
| 221 | - */ |
|
| 222 | - public function url_property() { |
|
| 223 | - |
|
| 224 | - return new Wordlift_Url_Property_Storage( $this->property_getter ); |
|
| 225 | - } |
|
| 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 | + |
|
| 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 | + |
|
| 39 | + /** |
|
| 40 | + * The {@link Wordlift_Property_Getter} instance. |
|
| 41 | + * |
|
| 42 | + * @since 3.15.0 |
|
| 43 | + * @access private |
|
| 44 | + * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} instance. |
|
| 45 | + */ |
|
| 46 | + private $property_getter; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * The singleton instance. |
|
| 50 | + * |
|
| 51 | + * @since 3.15.0 |
|
| 52 | + * @access private |
|
| 53 | + * @var \Wordlift_Storage_Factory $instance The singleton instance. |
|
| 54 | + */ |
|
| 55 | + private static $instance; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Create a {@link Wordlift_Storage_Factory} instance. |
|
| 59 | + * |
|
| 60 | + * @since 3.15.0 |
|
| 61 | + * |
|
| 62 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 63 | + * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 64 | + * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} instance. |
|
| 65 | + */ |
|
| 66 | + public function __construct( $entity_service, $user_service, $property_getter ) { |
|
| 67 | + |
|
| 68 | + $this->entity_service = $entity_service; |
|
| 69 | + $this->user_service = $user_service; |
|
| 70 | + $this->property_getter = $property_getter; |
|
| 71 | + |
|
| 72 | + self::$instance = $this; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Get the singleton instance. |
|
| 77 | + * |
|
| 78 | + * @since 3.15.0 |
|
| 79 | + * |
|
| 80 | + * @return \Wordlift_Storage_Factory The singleton instance. |
|
| 81 | + */ |
|
| 82 | + public static function get_instance() { |
|
| 83 | + |
|
| 84 | + return self::$instance; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 89 | + * titles. |
|
| 90 | + * |
|
| 91 | + * @since 3.15.0 |
|
| 92 | + * |
|
| 93 | + * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 94 | + * instance. |
|
| 95 | + */ |
|
| 96 | + public function post_title() { |
|
| 97 | + |
|
| 98 | + return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::TITLE ); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 103 | + * descriptions stripped of tags and shortcodes. |
|
| 104 | + * |
|
| 105 | + * @since 3.15.0 |
|
| 106 | + * |
|
| 107 | + * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 108 | + * instance. |
|
| 109 | + */ |
|
| 110 | + public function post_description_no_tags_no_shortcodes() { |
|
| 111 | + |
|
| 112 | + return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES ); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 117 | + * authors. |
|
| 118 | + * |
|
| 119 | + * @since 3.15.0 |
|
| 120 | + * |
|
| 121 | + * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 122 | + * instance. |
|
| 123 | + */ |
|
| 124 | + public function post_author() { |
|
| 125 | + |
|
| 126 | + return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 131 | + * metas. |
|
| 132 | + * |
|
| 133 | + * @since 3.15.0 |
|
| 134 | + * |
|
| 135 | + * @param string $meta_key The meta key to read. |
|
| 136 | + * |
|
| 137 | + * @return Wordlift_Post_Meta_Storage A {@link Wordlift_Post_Meta_Storage} |
|
| 138 | + * instance. |
|
| 139 | + */ |
|
| 140 | + public function post_meta( $meta_key ) { |
|
| 141 | + |
|
| 142 | + return new Wordlift_Post_Meta_Storage( $meta_key ); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Get a {@link Wordlift_Post_Schema_Class_Storage} to read {@link WP_Post}s' |
|
| 147 | + * entity type class. |
|
| 148 | + * |
|
| 149 | + * @since 3.15.0 |
|
| 150 | + * |
|
| 151 | + * @return Wordlift_Post_Schema_Class_Storage A {@link Wordlift_Post_Schema_Class_Storage} |
|
| 152 | + * instance. |
|
| 153 | + */ |
|
| 154 | + public function schema_class() { |
|
| 155 | + |
|
| 156 | + return new Wordlift_Post_Schema_Class_Storage(); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Get a {@link Wordlift_Post_Author_Storage} instance able to turn an author |
|
| 161 | + * id into a URI. |
|
| 162 | + * |
|
| 163 | + * @since 3.15.0 |
|
| 164 | + * |
|
| 165 | + * @return \Wordlift_Post_Author_Storage A {@link Wordlift_Post_Author_Storage} |
|
| 166 | + * instance. |
|
| 167 | + */ |
|
| 168 | + public function author_uri() { |
|
| 169 | + |
|
| 170 | + return new Wordlift_Post_Author_Storage( $this->entity_service, $this->user_service ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Get a {@link Wordlift_Post_Meta_Uri_Storage} instance which reads {@link WP_Post} |
|
| 175 | + * ids and maps them to URI. |
|
| 176 | + * |
|
| 177 | + * @param string $meta_key The {@link WP_Post}'s meta key. |
|
| 178 | + * |
|
| 179 | + * @return \Wordlift_Post_Meta_Uri_Storage A {@link Wordlift_Post_Meta_Uri_Storage} |
|
| 180 | + * instance. |
|
| 181 | + */ |
|
| 182 | + public function post_meta_to_uri( $meta_key ) { |
|
| 183 | + |
|
| 184 | + return new Wordlift_Post_Meta_Uri_Storage( $meta_key, $this->entity_service ); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Get a list of {@link WP_Post}'s images URI. |
|
| 189 | + * |
|
| 190 | + * @since 3.15.0 |
|
| 191 | + * |
|
| 192 | + * @return \Wordlift_Post_Image_Storage A {@link Wordlift_Post_Image_Storage} |
|
| 193 | + * instance. |
|
| 194 | + */ |
|
| 195 | + public function post_images() { |
|
| 196 | + |
|
| 197 | + return new Wordlift_Post_Image_Storage(); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Get a {@link Wordlift_Post_Related_Storage} instance to get related |
|
| 202 | + * {@link WP_Post}s. |
|
| 203 | + * |
|
| 204 | + * @since 3.15.0 |
|
| 205 | + * |
|
| 206 | + * @return \Wordlift_Post_Related_Storage A {@link Wordlift_Post_Related_Storage} |
|
| 207 | + * instance. |
|
| 208 | + */ |
|
| 209 | + public function relations() { |
|
| 210 | + |
|
| 211 | + return new Wordlift_Post_Related_Storage( $this->entity_service ); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * Get the {@link Wordlift_Url_Property_Storage} instance. |
|
| 216 | + * |
|
| 217 | + * @since 3.15.0 |
|
| 218 | + * |
|
| 219 | + * @return \Wordlift_Url_Property_Storage The {@link Wordlift_Url_Property_Storage} |
|
| 220 | + * instance. |
|
| 221 | + */ |
|
| 222 | + public function url_property() { |
|
| 223 | + |
|
| 224 | + return new Wordlift_Url_Property_Storage( $this->property_getter ); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
| 64 | 64 | * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} instance. |
| 65 | 65 | */ |
| 66 | - public function __construct( $entity_service, $user_service, $property_getter ) { |
|
| 66 | + public function __construct($entity_service, $user_service, $property_getter) { |
|
| 67 | 67 | |
| 68 | 68 | $this->entity_service = $entity_service; |
| 69 | 69 | $this->user_service = $user_service; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function post_title() { |
| 97 | 97 | |
| 98 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::TITLE ); |
|
| 98 | + return new Wordlift_Post_Property_Storage(Wordlift_Post_Property_Storage::TITLE); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function post_description_no_tags_no_shortcodes() { |
| 111 | 111 | |
| 112 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES ); |
|
| 112 | + return new Wordlift_Post_Property_Storage(Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function post_author() { |
| 125 | 125 | |
| 126 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 126 | + return new Wordlift_Post_Property_Storage(Wordlift_Post_Property_Storage::AUTHOR); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | * @return Wordlift_Post_Meta_Storage A {@link Wordlift_Post_Meta_Storage} |
| 138 | 138 | * instance. |
| 139 | 139 | */ |
| 140 | - public function post_meta( $meta_key ) { |
|
| 140 | + public function post_meta($meta_key) { |
|
| 141 | 141 | |
| 142 | - return new Wordlift_Post_Meta_Storage( $meta_key ); |
|
| 142 | + return new Wordlift_Post_Meta_Storage($meta_key); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function author_uri() { |
| 169 | 169 | |
| 170 | - return new Wordlift_Post_Author_Storage( $this->entity_service, $this->user_service ); |
|
| 170 | + return new Wordlift_Post_Author_Storage($this->entity_service, $this->user_service); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | * @return \Wordlift_Post_Meta_Uri_Storage A {@link Wordlift_Post_Meta_Uri_Storage} |
| 180 | 180 | * instance. |
| 181 | 181 | */ |
| 182 | - public function post_meta_to_uri( $meta_key ) { |
|
| 182 | + public function post_meta_to_uri($meta_key) { |
|
| 183 | 183 | |
| 184 | - return new Wordlift_Post_Meta_Uri_Storage( $meta_key, $this->entity_service ); |
|
| 184 | + return new Wordlift_Post_Meta_Uri_Storage($meta_key, $this->entity_service); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function relations() { |
| 210 | 210 | |
| 211 | - return new Wordlift_Post_Related_Storage( $this->entity_service ); |
|
| 211 | + return new Wordlift_Post_Related_Storage($this->entity_service); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function url_property() { |
| 223 | 223 | |
| 224 | - return new Wordlift_Url_Property_Storage( $this->property_getter ); |
|
| 224 | + return new Wordlift_Url_Property_Storage($this->property_getter); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <!-- Pane 6 content --> |
| 2 | 2 | <script type="text/html" id="page-5"> |
| 3 | 3 | <h2 class="page-title"> |
| 4 | - <?php esc_html_e( 'Publisher', 'wordlift' ); ?> |
|
| 4 | + <?php esc_html_e('Publisher', 'wordlift'); ?> |
|
| 5 | 5 | </h2> |
| 6 | 6 | |
| 7 | 7 | <p class="page-txt"> |
| 8 | - <?php esc_html_e( 'Are you going to publish as an individual or as a company?', 'wordlift' ); ?> |
|
| 8 | + <?php esc_html_e('Are you going to publish as an individual or as a company?', 'wordlift'); ?> |
|
| 9 | 9 | </p> |
| 10 | 10 | |
| 11 | 11 | <div class="radio-wrapper"> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | <span class="radio"><span class="check"></span></span> |
| 21 | 21 | |
| 22 | 22 | <span class="label"> |
| 23 | - <?php esc_html_e( 'Personal', 'wordlift' ); ?> |
|
| 23 | + <?php esc_html_e('Personal', 'wordlift'); ?> |
|
| 24 | 24 | </span> |
| 25 | 25 | </label> |
| 26 | 26 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | <span class="radio"><span class="check"></span></span> |
| 36 | 36 | |
| 37 | 37 | <span class="label"> |
| 38 | - <?php esc_html_e( 'Company', 'wordlift' ); ?> |
|
| 38 | + <?php esc_html_e('Company', 'wordlift'); ?> |
|
| 39 | 39 | </span> |
| 40 | 40 | </label> |
| 41 | 41 | </div> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | value="" |
| 48 | 48 | autocomplete="off" |
| 49 | 49 | class="untouched invalid" |
| 50 | - placeholder="<?php esc_attr_e( "What's your name?", 'wordlift' ); ?>" |
|
| 50 | + placeholder="<?php esc_attr_e("What's your name?", 'wordlift'); ?>" |
|
| 51 | 51 | > |
| 52 | 52 | |
| 53 | 53 | <div data-wl-logo="wl-logo"> |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | class="add-logo" |
| 66 | 66 | href="javascript:void(0);" |
| 67 | 67 | > |
| 68 | - <?php esc_html_e( 'Add your logo', 'wordlift' ); ?> |
|
| 68 | + <?php esc_html_e('Add your logo', 'wordlift'); ?> |
|
| 69 | 69 | </a> |
| 70 | 70 | </div> |
| 71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | type="submit" |
| 75 | 75 | id="btn-finish" |
| 76 | 76 | class="wl-default-action" |
| 77 | - value="<?php esc_attr_e( 'Finish', 'wordlift' ); ?>" |
|
| 77 | + value="<?php esc_attr_e('Finish', 'wordlift'); ?>" |
|
| 78 | 78 | > |
| 79 | 79 | </div> |
| 80 | 80 | </script> |
@@ -15,32 +15,32 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Wordlift_Batch_Operation_Interface { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Process the batch operation starting from the specified offset. |
|
| 20 | - * |
|
| 21 | - * @since 3.20.0 |
|
| 22 | - * |
|
| 23 | - * @param int $offset Start from the specified offset (or 0 if not specified). |
|
| 24 | - * @param int $limit Process the specified amount of items per call (or 10 if not specified). |
|
| 25 | - * |
|
| 26 | - * @return array { |
|
| 27 | - * The operation result. |
|
| 28 | - * |
|
| 29 | - * @type int $next The next offset. |
|
| 30 | - * @type int $limit The amount of items to process per call. |
|
| 31 | - * @type int $remaining The remaining number of elements to process. |
|
| 32 | - * @type bool $complete Whether the operation completed. |
|
| 33 | - * } |
|
| 34 | - */ |
|
| 35 | - public function process( $offset = 0, $limit = 10 ); |
|
| 18 | + /** |
|
| 19 | + * Process the batch operation starting from the specified offset. |
|
| 20 | + * |
|
| 21 | + * @since 3.20.0 |
|
| 22 | + * |
|
| 23 | + * @param int $offset Start from the specified offset (or 0 if not specified). |
|
| 24 | + * @param int $limit Process the specified amount of items per call (or 10 if not specified). |
|
| 25 | + * |
|
| 26 | + * @return array { |
|
| 27 | + * The operation result. |
|
| 28 | + * |
|
| 29 | + * @type int $next The next offset. |
|
| 30 | + * @type int $limit The amount of items to process per call. |
|
| 31 | + * @type int $remaining The remaining number of elements to process. |
|
| 32 | + * @type bool $complete Whether the operation completed. |
|
| 33 | + * } |
|
| 34 | + */ |
|
| 35 | + public function process( $offset = 0, $limit = 10 ); |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Count the number of elements that would be affected by the operation. |
|
| 39 | - * |
|
| 40 | - * @since 3.20.0 |
|
| 41 | - * |
|
| 42 | - * @return int The number of elements that would be affected. |
|
| 43 | - */ |
|
| 44 | - public function count(); |
|
| 37 | + /** |
|
| 38 | + * Count the number of elements that would be affected by the operation. |
|
| 39 | + * |
|
| 40 | + * @since 3.20.0 |
|
| 41 | + * |
|
| 42 | + * @return int The number of elements that would be affected. |
|
| 43 | + */ |
|
| 44 | + public function count(); |
|
| 45 | 45 | |
| 46 | 46 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * @type bool $complete Whether the operation completed. |
| 33 | 33 | * } |
| 34 | 34 | */ |
| 35 | - public function process( $offset = 0, $limit = 10 ); |
|
| 35 | + public function process($offset = 0, $limit = 10); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Count the number of elements that would be affected by the operation. |