| @@ -7,8 +7,9 @@ | ||
| 7 | 7 | use Photonic_Plugin\Components\Grid_Figure; |
| 8 | 8 | use Photonic_Plugin\Components\Grid_Image; |
| 9 | 9 | use Photonic_Plugin\Components\Pagination; |
| 10 | 10 | use Photonic_Plugin\Components\Photo_List; |
| 11 | +use Photonic_Plugin\Core\Photonic; | |
| 11 | 12 | use Photonic_Plugin\Layouts\Features\Can_Use_Lightbox; |
| 12 | 13 | use Photonic_Plugin\Platforms\Base; |
| 13 | 14 | use Photonic_Plugin\Components\Album; |
| 14 | 15 | use Photonic_Plugin\Components\Photo; |
| @@ -154,9 +155,10 @@ | ||
| 154 | 155 | |
| 155 | 156 | $shown_title = ''; |
| 156 | 157 | if (in_array($title_position, ['below', 'hover-slideup-show', 'hover-slidedown-show', 'slideup-stick'], true) && !empty($title)) { |
| 157 | 158 | // Convoluted... we want to remove any funky markup from $title, so wp_filter_nohtml_kses is used. But that does an `addslashes`, which causes more funky markup. So we use stripslashes, but then we decode the special characters. |
| 158 | - $shown_title = '<figcaption class="photonic-title-info"><div class="photonic-photo-title photonic-title">' . wp_specialchars_decode(stripslashes(wp_filter_nohtml_kses($title)), ENT_QUOTES) . '</div></figcaption>'; | |
| 159 | + // $shown_title = '<figcaption class="photonic-title-info"><div class="photonic-photo-title photonic-title">' . wp_specialchars_decode(stripslashes(wp_filter_nohtml_kses($title)), ENT_QUOTES) . '</div></figcaption>'; | |
| 160 | + $shown_title = '<figcaption class="photonic-title-info"><div class="photonic-photo-title photonic-title">' . wp_specialchars_decode(stripslashes(wp_kses($title, Photonic::$safe_description_tags)), ENT_QUOTES) . '</div></figcaption>'; | |
| 159 | 161 | } |
| 160 | 162 | |
| 161 | 163 | $photo_data = ['title' => $title_markup, 'deep' => $deep_value, 'raw_title' => esc_attr($title)]; |
| 162 | 164 | if (!empty($photo->download)) { |
| @@ -244,9 +246,9 @@ | ||
| 244 | 246 | * exists in native WP and Instagram. |
| 245 | 247 | * |
| 246 | 248 | * @param Album_List $album_list |
| 247 | 249 | * @param array $short_code |
| 248 | - * @param $module Base | |
| 250 | + * @param Base $module | |
| 249 | 251 | * @return string |
| 250 | 252 | */ |
| 251 | 253 | public function generate_level_2_gallery(Album_List $album_list, array $short_code, Base $module): string { |
| 252 | 254 | $module->push_to_stack('Generate Level 2 Gallery'); |
| @@ -287,10 +289,8 @@ | ||
| 287 | 289 | if ($album_list->album_opens_gallery) { |
| 288 | 290 | $gallery_anchor_classes[] = 'gallery-page'; |
| 289 | 291 | } |
| 290 | 292 | |
| 291 | - $counter = 0; | |
| 292 | - | |
| 293 | 293 | $layout_engine = $this->get_layout_engine($module, $short_code); |
| 294 | 294 | $all_sizes_present = strtolower($layout_engine) === 'css'; |
| 295 | 295 | |
| 296 | 296 | $ret = ''; |
| @@ -341,13 +341,13 @@ | ||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | $shown_title = ''; |
| 344 | 344 | if (in_array($title_position, ['below', 'hover-slideup-show', 'hover-slidedown-show', 'slideup-stick'], true)) { |
| 345 | - $shown_title = "\n{$indent}\t\t\t<figcaption class='photonic-title-info'>\n{$indent}\t\t\t\t<div class='photonic-$singular_type-title photonic-title'>" . wp_specialchars_decode(stripslashes(wp_filter_nohtml_kses($title)), ENT_QUOTES) . ""; | |
| 345 | + $shown_title = "\n$indent\t\t\t<figcaption class='photonic-title-info'>\n$indent\t\t\t\t<div class='photonic-$singular_type-title photonic-title'>" . wp_specialchars_decode(stripslashes(wp_filter_nohtml_kses($title)), ENT_QUOTES); | |
| 346 | 346 | if (!$level_1_count_display && !empty($object->counter)) { |
| 347 | 347 | $shown_title .= '<span class="photonic-title-photo-count photonic-' . $singular_type . '-photo-count">' . sprintf(esc_html__('%s photos', 'photonic'), $object->counter) . '</span>'; |
| 348 | 348 | } |
| 349 | - $shown_title .= "</div>\n{$indent}\t\t\t</figcaption>"; | |
| 349 | + $shown_title .= "</div>\n$indent\t\t\t</figcaption>"; | |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | $grid_image = new Grid_Image(); |
| 353 | 353 | $grid_image->alt = esc_attr($title); |
| @@ -355,9 +355,9 @@ | ||
| 355 | 355 | $grid_image->classes = [sanitize_html_class($layout)]; |
| 356 | 356 | $grid_image->dimensions = $inbuilt_sizes ?? []; |
| 357 | 357 | |
| 358 | 358 | $grid_anchor = new Grid_Anchor(); |
| 359 | - $grid_anchor->id = "photonic-{$provider}-$singular_type-thumb-$id"; | |
| 359 | + $grid_anchor->id = "photonic-$provider-$singular_type-thumb-$id"; | |
| 360 | 360 | $grid_anchor->href = esc_url($object->gallery_url ?? $object->main_page); |
| 361 | 361 | $grid_anchor->classes = array_merge($gallery_anchor_classes, $object->classes); |
| 362 | 362 | $grid_anchor->data = $anchor_data; |
| 363 | 363 | $grid_anchor->title = 'none' !== $title_position ? esc_attr($title) : ''; |
| @@ -365,9 +365,9 @@ | ||
| 365 | 365 | $grid_anchor->image = $grid_image; |
| 366 | 366 | $grid_anchor->indent = $indent; |
| 367 | 367 | |
| 368 | 368 | $grid_figure = new Grid_Figure(); |
| 369 | - $grid_figure->id = "photonic-{$provider}-$singular_type-$id"; | |
| 369 | + $grid_figure->id = "photonic-$provider-$singular_type-$id"; | |
| 370 | 370 | $grid_figure->classes = $gallery_figure_classes; |
| 371 | 371 | $grid_figure->styles = $styles; |
| 372 | 372 | $grid_figure->data = $figure_data; |
| 373 | 373 | $grid_figure->anchor = $grid_anchor; |
| @@ -374,9 +374,8 @@ | ||
| 374 | 374 | $grid_figure->indent = $indent; |
| 375 | 375 | $grid_figure->prompter_markup = $this->get_password_prompter($object, $provider, $singular_type, $id); |
| 376 | 376 | |
| 377 | 377 | $grid_figures[] = $grid_figure; |
| 378 | - $counter++; | |
| 379 | 378 | } |
| 380 | 379 | |
| 381 | 380 | if (!empty($grid_figures)) { |
| 382 | 381 | $this->set_lazy_loading_attributes($all_sizes_present, $grid_figures); |
| @@ -498,20 +497,20 @@ | ||
| 498 | 497 | private function get_password_prompter(Album $object, string $provider, string $singular_type, string $id): string { |
| 499 | 498 | $password_prompt = ''; |
| 500 | 499 | if (!empty($object->passworded)) { |
| 501 | 500 | $password_prompt = " |
| 502 | - <div class='photonic-password-prompter' id='photonic-{$provider}-$singular_type-prompter-$id' title='{$this->prompt_title}' data-photonic-prompt='password'> | |
| 501 | + <div class='photonic-password-prompter' id='photonic-$provider-$singular_type-prompter-$id' title='$this->prompt_title' data-photonic-prompt='password'> | |
| 503 | 502 | <div class='photonic-password-prompter-content'> |
| 504 | 503 | <div class='photonic-prompt-head'> |
| 505 | 504 | <h3> |
| 506 | - <span class='title'>{$this->prompt_title}</span> | |
| 505 | + <span class='title'>$this->prompt_title</span> | |
| 507 | 506 | <button class='close'>×</button> |
| 508 | 507 | </h3> |
| 509 | 508 | </div> |
| 510 | 509 | <div class='photonic-prompt-body'> |
| 511 | - <p>{$this->prompt_text}</p> | |
| 512 | - <input type='password' name='photonic-{$provider}-password' /> | |
| 513 | - <button class='photonic-{$provider}-submit photonic-password-submit confirm'>{$this->prompt_submit}</button> | |
| 510 | + <p>$this->prompt_text</p> | |
| 511 | + <input type='password' name='photonic-$provider-password' /> | |
| 512 | + <button class='photonic-$provider-submit photonic-password-submit confirm'>$this->prompt_submit</button> | |
| 514 | 513 | </div> |
| 515 | 514 | </div> |
| 516 | 515 | </div>"; |
| 517 | 516 | } |
| @@ -614,12 +613,12 @@ | ||
| 614 | 613 | foreach ($grid_figures as $figure) { |
| 615 | 614 | $ret .= $figure->html($module, $this, false); |
| 616 | 615 | } |
| 617 | 616 | |
| 618 | - $ret .= "\n$indent</div> <!-- ./photonic-level-{$level}-container -->"; | |
| 617 | + $ret .= "\n$indent</div> <!-- ./photonic-level-$level-container -->"; | |
| 619 | 618 | $ret .= "\n$indent<span id='$end_id'></span>"; |
| 620 | 619 | |
| 621 | - if (!empty($pagination) && isset($pagination->end) && isset($pagination->total) && $pagination->total > $pagination->end) { | |
| 620 | + if ($pagination->end > -1 && $pagination->total > -1 && $pagination->total > $pagination->end) { | |
| 622 | 621 | $ret .= !empty($more) ? "\n$indent<a href='#' class='photonic-more-button photonic-more-dynamic'>$more</a>\n" : ''; |
| 623 | 622 | } |
| 624 | 623 | } |
| 625 | 624 | return $ret; |