| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * @author Podlove <[email protected]> |
||||
| 4 | * @copyright Copyright (c) 2014-2018, Podlove |
||||
| 5 | * @license https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT |
||||
| 6 | * @package Podlove\PodloveSubscribeButton |
||||
| 7 | */ |
||||
| 8 | |||||
| 9 | namespace PodloveSubscribeButton; |
||||
| 10 | |||||
| 11 | class Defaults { |
||||
| 12 | |||||
| 13 | static function button( $property ) { |
||||
| 14 | |||||
| 15 | $style = array( |
||||
| 16 | 'filled' => __( 'Filled', 'podlove-subscribe-button' ), |
||||
| 17 | 'outline' => __( 'Outline', 'podlove-subscribe-button' ), |
||||
| 18 | 'frameless' => __( 'Frameless', 'podlove-subscribe-button' ), |
||||
| 19 | ); |
||||
| 20 | |||||
| 21 | $format = array( |
||||
| 22 | 'rectangle' => __( 'Rectangle', 'podlove-subscribe-button' ), |
||||
| 23 | 'square' => __( 'Square', 'podlove-subscribe-button' ), |
||||
| 24 | 'cover' => __( 'Cover', 'podlove-subscribe-button' ), |
||||
| 25 | ); |
||||
| 26 | |||||
| 27 | $autowidth = array( |
||||
| 28 | 'on' => __( 'Yes', 'podlove-subscribe-button' ), |
||||
| 29 | 'off' => __( 'No', 'podlove-subscribe-button' ), |
||||
| 30 | ); |
||||
| 31 | |||||
| 32 | $size = array( |
||||
| 33 | 'small' => __( 'Small', 'podlove-subscribe-button' ), |
||||
| 34 | 'medium' => __( 'Medium', 'podlove-subscribe-button' ), |
||||
| 35 | 'big' => __( 'Big', 'podlove-subscribe-button' ), |
||||
| 36 | ); |
||||
| 37 | |||||
| 38 | $language = array( 'de', 'en', 'eo', 'fi', 'fr', 'nl', 'zh', 'ja', ); |
||||
| 39 | |||||
| 40 | return $$property; |
||||
| 41 | |||||
| 42 | } |
||||
| 43 | |||||
| 44 | /** |
||||
| 45 | * @return array |
||||
| 46 | */ |
||||
| 47 | public static function media_types() { |
||||
| 48 | |||||
| 49 | $media_types = array( |
||||
| 50 | 0 => array( |
||||
| 51 | 'title' => 'MP3 audio', |
||||
| 52 | 'mime_type' => 'audio/mpeg', |
||||
| 53 | 'extension' => 'mp3', |
||||
| 54 | ), |
||||
| 55 | 1 => array( |
||||
| 56 | 'title' => 'MPEG-4 AAC Audio', |
||||
| 57 | 'mime_type' => 'audio/mp4', |
||||
| 58 | 'extension' => 'aac', |
||||
| 59 | ), |
||||
| 60 | 2 => array( |
||||
| 61 | 'title' => 'MPEG-4 ALAC Audio', |
||||
| 62 | 'mime_type' => 'audio/mp4', |
||||
| 63 | 'extension' => 'aac', |
||||
| 64 | ), |
||||
| 65 | 3 => array( |
||||
| 66 | 'title' => 'Ogg Vorbis Audio', |
||||
| 67 | 'mime_type' => 'audio/ogg', |
||||
| 68 | 'extension' => 'ogg', |
||||
| 69 | ), |
||||
| 70 | 4 => array( |
||||
| 71 | 'title' => 'WebM Audio', |
||||
| 72 | 'mime_type' => 'audio/webm', |
||||
| 73 | 'extension' => 'webm', |
||||
| 74 | ), |
||||
| 75 | 5 => array( |
||||
| 76 | 'title' => 'FLAC Audio', |
||||
| 77 | 'mime_type' => 'audio/flac', |
||||
| 78 | 'extension' => 'flac', |
||||
| 79 | ), |
||||
| 80 | 6 => array( |
||||
| 81 | 'title' => 'Matroska Audio', |
||||
| 82 | 'mime_type' => 'audio/x-matroska', |
||||
| 83 | 'extension' => 'mka', |
||||
| 84 | ), |
||||
| 85 | 7 => array( |
||||
| 86 | 'title' => 'Opus Audio', |
||||
| 87 | 'mime_type' => 'audio/opus', |
||||
| 88 | 'extension' => 'opus', |
||||
| 89 | ) |
||||
| 90 | ); |
||||
| 91 | |||||
| 92 | return apply_filters( 'podlove_psb_defaults_media_types', $media_types ); |
||||
| 93 | |||||
| 94 | } |
||||
| 95 | |||||
| 96 | static function options_install() { |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
options_install.
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with Loading history...
|
|||||
| 97 | |||||
| 98 | $options = array( |
||||
| 99 | 'size' => 'big', |
||||
| 100 | 'autowidth' => 'on', |
||||
| 101 | 'color' => '#599677', |
||||
| 102 | 'style' => 'filled', |
||||
| 103 | 'format' => 'rectangle', |
||||
| 104 | 'language' => \PodloveSubscribeButton\Helpers::language( get_site_option( 'WPLANG' ) ), |
||||
|
0 ignored issues
–
show
It seems like
get_site_option('WPLANG') can also be of type false; however, parameter $language of PodloveSubscribeButton\Helpers::language() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 105 | ); |
||||
| 106 | |||||
| 107 | return $options; |
||||
| 108 | |||||
| 109 | } |
||||
| 110 | |||||
| 111 | static function options() { |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
options.
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with Loading history...
|
|||||
| 112 | |||||
| 113 | $options = array( |
||||
| 114 | 'size' => 'big', |
||||
| 115 | 'autowidth' => 'on', |
||||
| 116 | 'color' => '#599677', |
||||
| 117 | 'style' => 'filled', |
||||
| 118 | 'format' => 'rectangle', |
||||
| 119 | 'language' => \PodloveSubscribeButton\Helpers::language( '' ), |
||||
| 120 | ); |
||||
| 121 | |||||
| 122 | return apply_filters( 'podlove_psb_defaults_options', $options ); |
||||
| 123 | |||||
| 124 | } |
||||
| 125 | |||||
| 126 | } // END class |
||||
| 127 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.