PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.36
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.36
3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 2.44 All 141 releases
← All changes | Core/Utilities.php +45 -30 2.413.36 View file →
@@ -1,9 +1,10 @@
1 1 <?php
2 +
2 3 namespace Photonic_Plugin\Core;
3 4
4 5 class Utilities {
5 - public static function get_formatted_post_type_array() {
6 + public static function get_formatted_post_type_array(): array {
6 7 global $photonic_post_type_array;
7 8 $ret = [];
8 9
9 10 $post_types = get_post_types(['show_ui' => 1], 'objects');
@@ -8,9 +9,9 @@
8 9
9 10 $post_types = get_post_types(['show_ui' => 1], 'objects');
10 11 if (!empty($post_types)) {
11 12 foreach ($post_types as $name => $post_type) {
12 - $ret[$name] = ["title" => $post_type->label." (Post type: $name)", "depth" => 0];
13 + $ret[$name] = ["title" => $post_type->label . " (Post type: $name)", "depth" => 0];
13 14 }
14 15 }
15 16
16 17 $photonic_post_type_array = $ret;
@@ -16,9 +17,9 @@
16 17 $photonic_post_type_array = $ret;
17 18 return $ret;
18 19 }
19 20
20 - public static function get_pages() {
21 + public static function get_pages(): array {
21 22 $pages = get_pages();
22 23 $output = [
23 24 '' => '',
24 25 ];
@@ -27,59 +28,73 @@
27 28 }
28 29 return $output;
29 30 }
30 31
31 - public static function title_caption_options($blank = false, $selection = false) {
32 + public static function title_caption_options($blank = false, $selection = false, $alt = false): array {
32 33 $ret = [
33 - '' => esc_html__('Default from settings', 'photonic'),
34 - 'none' => esc_html__('No title / caption / description', 'photonic'),
35 - 'title' => esc_html__('Always use the photo title, even if blank', 'photonic'),
36 - 'desc' => esc_html__('Always use the photo description / caption, even if blank', 'photonic'),
34 + '' => esc_html__('Default from settings', 'photonic'),
35 + 'none' => esc_html__('No title / caption / description', 'photonic'),
36 + 'title' => esc_html__('Always use the photo title, even if blank', 'photonic'),
37 + 'desc' => esc_html__('Always use the photo description / caption, even if blank', 'photonic'),
37 38 'desc-title' => esc_html__('Use the photo description / caption. If blank use the title', 'photonic'),
38 39 'title-desc' => esc_html__('Use the photo title. If blank use the description / caption', 'photonic'),
39 40 ];
40 41
42 + if ($alt) {
43 + $ret['alt'] = esc_html__('Always use the alt text, even if blank', 'photonic');
44 + $ret['alt-title-desc'] = esc_html__('Use the alt text. If blank use the title. If blank use the description / caption', 'photonic');
45 + $ret['alt-desc-title'] = esc_html__('Use the alt text. If blank use the description / caption. If blank use the title', 'photonic');
46 +
47 + $ret['desc-title-alt'] = esc_html__('Use the photo description / caption. If blank use the title. If blank use the alt text', 'photonic');
48 + $ret['desc-alt-title'] = esc_html__('Use the photo description / caption. If blank use the alt text. If blank use the title', 'photonic');
49 +
50 + $ret['title-alt-desc'] = esc_html__('Use the photo title. If blank use the alt text. If blank use the description / caption', 'photonic');
51 + $ret['title-desc-alt'] = esc_html__('Use the photo title. If blank use the description / caption. If blank use the alt text', 'photonic');
52 + }
41 53 if (!$blank) {
42 54 unset($ret['']);
43 55 }
44 - else if (!empty($ret[$selection])) {
45 - $ret[''] .= ' - '.$ret[$selection];
56 + elseif (!empty($ret[$selection])) {
57 + $ret[''] .= ' - ' . $ret[$selection];
46 58 }
47 59
48 60 return $ret;
49 61 }
50 62
51 - public static function layout_options($show_blank = false, $blank_text = '') {
63 + public static function layout_options($show_blank = false, $blank_text = ''): array {
52 64 $ret = [];
53 65 if ($show_blank) {
54 66 $ret[''] = $blank_text;
55 67 }
56 - return array_merge($ret, [
57 - 'strip-below' => esc_html__('Thumbnail strip below slideshow', 'photonic'),
58 - 'strip-above' => esc_html__('Thumbnail strip above slideshow', 'photonic'),
59 - 'strip-right' => esc_html__('Thumbnail strip to the right of the slideshow', 'photonic'),
60 - 'no-strip' => esc_html__('Slideshow without thumbnails', 'photonic'),
61 - 'square' => esc_html__('Square thumbnail grid, lightbox', 'photonic'),
62 - 'circle' => esc_html__('Circular thumbnail grid, lightbox', 'photonic'),
63 - 'random' => esc_html__('Random justified gallery, lightbox', 'photonic'),
64 - 'masonry' => esc_html__('Masonry layout, lightbox', 'photonic'),
65 - 'mosaic' => esc_html__('Mosaic layout, lightbox', 'photonic'),
66 - ]);
68 + return array_merge(
69 + $ret,
70 + [
71 + 'strip-below' => esc_html__('Thumbnail strip below slideshow', 'photonic'),
72 + 'strip-above' => esc_html__('Thumbnail strip above slideshow', 'photonic'),
73 + 'strip-right' => esc_html__('OBSOLETE - Thumbnail strip to the right of the slideshow', 'photonic'),
74 + 'no-strip' => esc_html__('Slideshow without thumbnails', 'photonic'),
75 + 'square' => esc_html__('Square thumbnail grid, lightbox', 'photonic'),
76 + 'circle' => esc_html__('Circular thumbnail grid, lightbox', 'photonic'),
77 + 'random' => esc_html__('Random justified gallery, lightbox', 'photonic'),
78 + 'masonry' => esc_html__('Masonry layout, lightbox', 'photonic'),
79 + 'mosaic' => esc_html__('Mosaic layout, lightbox', 'photonic'),
80 + ]
81 + );
67 82 }
68 83
69 - public static function media_options($blank = false, $selection = false) {
84 + public static function media_options($blank = false, $selection = false): array {
70 85 $options = [
71 - '' => esc_html__('Default from settings', 'photonic'),
86 + '' => esc_html__('Default from settings', 'photonic'),
72 87 'photos' => esc_html__('Photos only', 'photonic'),
73 88 'videos' => esc_html__('Videos only', 'photonic'),
74 - 'all' => esc_html__('Both photos and videos', 'photonic'),
89 + 'all' => esc_html__('Both photos and videos', 'photonic'),
75 90 ];
76 91
77 92 if (!$blank) {
78 93 unset($options['']);
79 94 }
80 - else if (!empty($options[$selection])) {
81 - $options[''] .= ' - '.$options[$selection];
95 + elseif (!empty($options[$selection])) {
96 + $options[''] .= ' - ' . $options[$selection];
82 97 }
83 98
84 99 return $options;
85 100 }
@@ -88,9 +103,9 @@
88 103 * @param $show_full
89 104 * @param bool $return_formatted
90 105 * @return array
91 106 */
92 - public static function get_wp_image_sizes($show_full, $return_formatted = false) {
107 + public static function get_wp_image_sizes($show_full, bool $return_formatted = false): array {
93 108 global $_wp_additional_image_sizes;
94 109 $image_sizes = [];
95 110 $standard_sizes = ['thumbnail', 'medium', 'large'];
96 111 if ($show_full) {
@@ -96,9 +111,9 @@
96 111 if ($show_full) {
97 112 $standard_sizes[] = 'full';
98 113 }
99 114 foreach ($standard_sizes as $standard_size) {
100 - if ($standard_size != 'full') {
115 + if ('full' !== $standard_size) {
101 116 $image_sizes[$standard_size] = ['width' => get_option($standard_size . '_size_w'), 'height' => get_option($standard_size . '_size_h')];
102 117 }
103 118 else {
104 119 $image_sizes[$standard_size] = ['width' => esc_html__('Original width', 'photonic'), 'height' => esc_html__('Original height', 'photonic')];
@@ -116,5 +131,5 @@
116 131 return $formatted;
117 132 }
118 133 return $image_sizes;
119 134 }
120 -}
135 +}