| @@ -80,26 +80,23 @@ | ||
| 80 | 80 | $this->module->increment_gallery_index(); |
| 81 | 81 | $contents = $this->module->get_gallery_images($this->attr); |
| 82 | 82 | |
| 83 | 83 | $output = ''; |
| 84 | - if (is_array($contents)) { | |
| 85 | - foreach ($contents as $component) { | |
| 86 | - if (method_exists($component, 'html')) { | |
| 87 | - $output .= $component->html($this->module, $this->layout); | |
| 88 | - } | |
| 89 | - else { | |
| 90 | - $output .= $component; | |
| 91 | - } | |
| 84 | + foreach ($contents as $component) { | |
| 85 | + if (method_exists($component, 'html')) { | |
| 86 | + $output .= $component->html($this->module, $this->layout); | |
| 92 | 87 | } |
| 93 | - | |
| 94 | - // Special case --> when a native gallery is called with no <code>style</code> attribute, or if <code>style='default'</code>... | |
| 95 | - if (empty($output)) { | |
| 96 | - return ''; | |
| 88 | + else { | |
| 89 | + $output .= $component; | |
| 97 | 90 | } |
| 91 | + } | |
| 98 | 92 | |
| 99 | - return $this->finalize_markup($output); | |
| 93 | + // Special case --> when a native gallery is called with no <code>style</code> attribute, or if <code>style='default'</code>... | |
| 94 | + if (empty($output)) { | |
| 95 | + return ''; | |
| 100 | 96 | } |
| 101 | - return $output; | |
| 97 | + | |
| 98 | + return $this->finalize_markup($output); | |
| 102 | 99 | } |
| 103 | 100 | |
| 104 | 101 | public function get_helper_contents(): string { |
| 105 | 102 | return $this->module->execute_helper($this->attr); |
| @@ -114,12 +111,12 @@ | ||
| 114 | 111 | public function finalize_markup($content): string { |
| 115 | 112 | if ('modal' !== $this->attr['display']) { |
| 116 | 113 | $additional_classes = ''; |
| 117 | 114 | if (!empty($this->attr['custom_classes'])) { |
| 118 | - $additional_classes = $this->attr['custom_classes']; | |
| 115 | + $additional_classes = esc_attr($this->attr['custom_classes']); | |
| 119 | 116 | } |
| 120 | 117 | if (!empty($this->attr['alignment'])) { |
| 121 | - $additional_classes .= ' align' . $this->attr['alignment']; | |
| 118 | + $additional_classes .= ' align' . esc_attr($this->attr['alignment']); | |
| 122 | 119 | } |
| 123 | 120 | $ret = "<div class='photonic-{$this->module->provider}-stream photonic-stream $additional_classes' id='photonic-{$this->module->provider}-stream-{$this->module->gallery_index}'>\n"; |
| 124 | 121 | } |
| 125 | 122 | else { |