| 1 |
<?php |
| 2 |
|
| 3 |
namespace ISC; |
| 4 |
|
| 5 |
/** |
| 6 |
* Handling main plugin options |
| 7 |
*/ |
| 8 |
trait Options { |
| 9 |
|
| 10 |
/** |
| 11 |
* Returns isc_options if it exists, returns the default options otherwise. |
| 12 |
* |
| 13 |
* @return array |
| 14 |
*/ |
| 15 |
public static function get_options(): array { |
| 16 |
$options = get_option( 'isc_options', self::default_options() ); |
| 17 |
|
| 18 |
if ( ! is_array( $options ) ) { |
| 19 |
$options = self::default_options(); |
| 20 |
} |
| 21 |
|
| 22 |
return $options; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Returns default options |
| 27 |
* |
| 28 |
* @return string[] |
| 29 |
*/ |
| 30 |
public static function default_options(): array { |
| 31 |
$isc_default_licenses = 'All Rights Reserved |
| 32 |
Public Domain Mark 1.0|https://creativecommons.org/publicdomain/mark/1.0/ |
| 33 |
CC0 1.0 Universal|https://creativecommons.org/publicdomain/zero/1.0/ |
| 34 |
CC BY 4.0 International|https://creativecommons.org/licenses/by/4.0/ |
| 35 |
CC BY-SA 4.0 International|https://creativecommons.org/licenses/by-sa/4.0/ |
| 36 |
CC BY-ND 4.0 International|https://creativecommons.org/licenses/by-nd/4.0/ |
| 37 |
CC BY-NC 4.0 International|https://creativecommons.org/licenses/by-nc/4.0/ |
| 38 |
CC BY-NC-SA 4.0 International|https://creativecommons.org/licenses/by-nc-sa/4.0/ |
| 39 |
CC BY-NC-ND 4.0 International|https://creativecommons.org/licenses/by-nc-nd/4.0/ |
| 40 |
CC BY 3.0 Unported|https://creativecommons.org/licenses/by/3.0/ |
| 41 |
CC BY-SA 3.0 Unported|https://creativecommons.org/licenses/by-sa/3.0/ |
| 42 |
CC BY-ND 3.0 Unported|https://creativecommons.org/licenses/by-nd/3.0/ |
| 43 |
CC BY-NC 3.0 Unported|https://creativecommons.org/licenses/by-nc/3.0/ |
| 44 |
CC BY-NC-SA 3.0 Unported|https://creativecommons.org/licenses/by-nc-sa/3.0/ |
| 45 |
CC BY-NC-ND 3.0 Unported|https://creativecommons.org/licenses/by-nc-nd/3.0/ |
| 46 |
CC BY 2.5 Generic|https://creativecommons.org/licenses/by/2.5/ |
| 47 |
CC BY-SA 2.5 Generic|https://creativecommons.org/licenses/by-sa/2.5/ |
| 48 |
CC BY-ND 2.5 Generic|https://creativecommons.org/licenses/by-nd/2.5/ |
| 49 |
CC BY-NC 2.5 Generic|https://creativecommons.org/licenses/by-nc/2.5/ |
| 50 |
CC BY-NC-SA 2.5 Generic|https://creativecommons.org/licenses/by-nc-sa/2.5/ |
| 51 |
CC BY-NC-ND 2.5 Generic|https://creativecommons.org/licenses/by-nc-nd/2.5/ |
| 52 |
CC BY 2.0 Generic|https://creativecommons.org/licenses/by/2.0/ |
| 53 |
CC BY-SA 2.0 DE|https://creativecommons.org/licenses/by-sa/2.0/de/deed |
| 54 |
CC BY-SA 2.0 Generic|https://creativecommons.org/licenses/by-sa/2.0/ |
| 55 |
CC BY-ND 2.0 Generic|https://creativecommons.org/licenses/by-nd/2.0/ |
| 56 |
CC BY-NC 2.0 Generic|https://creativecommons.org/licenses/by-nc/2.0/ |
| 57 |
CC BY-NC-SA 2.0 Generic|https://creativecommons.org/licenses/by-nc-sa/2.0/ |
| 58 |
CC BY-NC-ND 2.0 Generic|https://creativecommons.org/licenses/by-nc-nd/2.0/ |
| 59 |
FAL Free Art License 1.3 |http://artlibre.org/licence/lal/en/ |
| 60 |
GFDL GNU Free Documentation License 1.2|https://www.gnu.org/licenses/fdl-1.2.html |
| 61 |
GFDL GNU Free Documentation License 1.3|https://www.gnu.org/licenses/fdl-1.3.html'; |
| 62 |
|
| 63 |
$default['display_type'] = [ 'list' ]; |
| 64 |
$default['list_on_archives'] = false; |
| 65 |
$default['list_on_excerpts'] = false; |
| 66 |
$default['image_list_headline'] = __( 'image sources', 'image-source-control-isc' ); |
| 67 |
$default['version'] = ISCVERSION; |
| 68 |
$default['images_per_page'] = 99999; |
| 69 |
$default['thumbnail_in_list'] = false; |
| 70 |
$default['thumbnail_size'] = 'thumbnail'; |
| 71 |
$default['thumbnail_width'] = 150; |
| 72 |
$default['thumbnail_height'] = 150; |
| 73 |
$default['warning_onesource_missing'] = true; |
| 74 |
$default['remove_on_uninstall'] = false; |
| 75 |
$default['caption_position'] = 'top-left'; |
| 76 |
$default['caption_style'] = null; |
| 77 |
$default['source_pretext'] = __( 'Source:', 'image-source-control-isc' ); |
| 78 |
$default['ai_images'] = [ |
| 79 |
'show_label' => false, |
| 80 |
'remove_wrapper_if_source_empty' => false, |
| 81 |
]; |
| 82 |
$default['enable_licences'] = false; |
| 83 |
$default['licences'] = apply_filters( 'isc-licences-list', $isc_default_licenses ); |
| 84 |
$default['list_included_images'] = ''; |
| 85 |
$default['overlay_included_images'] = ''; |
| 86 |
$default['block_options'] = true; |
| 87 |
$default['enable_log'] = false; |
| 88 |
$default['standard_source'] = 'custom_text'; |
| 89 |
$default['standard_source_text'] = ''; |
| 90 |
$default['images_only'] = false; |
| 91 |
|
| 92 |
/** |
| 93 |
* Allow manipulating defaults for plugin settings |
| 94 |
*/ |
| 95 |
return apply_filters( 'isc_default_settings', $default ); |
| 96 |
} |
| 97 |
} |
| 98 |
|