PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.3.2
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.3.2
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / src / Admin / Framework / fields / gallery / gallery.php

gallery.php in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 1.3.2, at src/Admin/Framework/fields/gallery/gallery.php

53 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) {
2 die; } // Cannot access directly.
3 /**
4 *
5 * Field: gallery
6 *
7 * @since 1.0.0
8 * @version 1.0.0
9 */
10 if ( ! class_exists( 'DarkifyField_gallery' ) ) {
11 class DarkifyField_gallery extends DarkifyFields {
12
13 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 parent::__construct( $field, $value, $unique, $where, $parent );
15 }
16
17 public function render() {
18
19 $args = wp_parse_args(
20 $this->field,
21 array(
22 'add_title' => esc_html__( 'Add Gallery', 'darkify' ),
23 'edit_title' => esc_html__( 'Edit Gallery', 'darkify' ),
24 'clear_title' => esc_html__( 'Clear', 'darkify' ),
25 )
26 );
27
28 $hidden = ( empty( $this->value ) ) ? ' hidden' : '';
29
30 echo wp_kses_post( $this->field_before() );
31
32 echo '<ul>';
33 if ( ! empty( $this->value ) ) {
34
35 $values = explode( ',', $this->value );
36
37 foreach ( $values as $id ) {
38 $attachment = wp_get_attachment_image_src( $id, 'thumbnail' );
39 echo '<li><img src="' . esc_url( $attachment[0] ) . '" /></li>';
40 }
41 }
42 echo '</ul>';
43
44 echo '<a href="#" class="button button-primary darkify-button">' . esc_html($args['add_title']) . '</a>';
45 echo '<a href="#" class="button darkify-edit-gallery' . esc_attr( $hidden ) . '">' . esc_html($args['edit_title']) . '</a>';
46 echo '<a href="#" class="button darkify-warning-primary darkify-clear-gallery' . esc_attr( $hidden ) . '">' . esc_html($args['clear_title']) . '</a>';
47 echo '<input type="hidden" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post( $this->field_attributes() ) . '/>';
48
49 echo wp_kses_post( $this->field_after() );
50 }
51 }
52 }
53