@@ -12,73 +12,73 @@ |
||
| 12 | 12 | // Don't duplicate me! |
| 13 | 13 | if ( ! class_exists( 'Redux_Gallery', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Main Redux_gallery class |
|
| 17 | - * |
|
| 18 | - * @since 3.0.0 |
|
| 19 | - */ |
|
| 20 | - class Redux_Gallery extends Redux_Field { |
|
| 15 | + /** |
|
| 16 | + * Main Redux_gallery class |
|
| 17 | + * |
|
| 18 | + * @since 3.0.0 |
|
| 19 | + */ |
|
| 20 | + class Redux_Gallery extends Redux_Field { |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Field Render Function. |
|
| 24 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 25 | - * |
|
| 26 | - * @since 1.0.0 |
|
| 27 | - * @access public |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function render() { |
|
| 31 | - echo '<div class="screenshot">'; |
|
| 22 | + /** |
|
| 23 | + * Field Render Function. |
|
| 24 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 25 | + * |
|
| 26 | + * @since 1.0.0 |
|
| 27 | + * @access public |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function render() { |
|
| 31 | + echo '<div class="screenshot">'; |
|
| 32 | 32 | |
| 33 | - if ( ! empty( $this->value ) ) { |
|
| 34 | - $ids = explode( ',', $this->value ); |
|
| 33 | + if ( ! empty( $this->value ) ) { |
|
| 34 | + $ids = explode( ',', $this->value ); |
|
| 35 | 35 | |
| 36 | - foreach ( $ids as $attachment_id ) { |
|
| 37 | - $img = wp_get_attachment_image_src( $attachment_id ); |
|
| 38 | - if ( ! false === $img ) { |
|
| 39 | - $alt = wp_prepare_attachment_for_js( $attachment_id ); |
|
| 40 | - $alt = $alt['alt'] ?? ''; |
|
| 36 | + foreach ( $ids as $attachment_id ) { |
|
| 37 | + $img = wp_get_attachment_image_src( $attachment_id ); |
|
| 38 | + if ( ! false === $img ) { |
|
| 39 | + $alt = wp_prepare_attachment_for_js( $attachment_id ); |
|
| 40 | + $alt = $alt['alt'] ?? ''; |
|
| 41 | 41 | |
| 42 | - echo '<a class="of-uploaded-image" href="' . esc_url( $img[0] ) . '">'; |
|
| 43 | - echo '<img class="redux-option-image" id="image_' . esc_attr( $this->field['id'] ) . '_' . esc_attr( $attachment_id ) . '" src="' . esc_url( $img[0] ) . '" alt="' . esc_attr( $alt ) . '" target="_blank" rel="external" />'; |
|
| 44 | - echo '</a>'; |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } |
|
| 42 | + echo '<a class="of-uploaded-image" href="' . esc_url( $img[0] ) . '">'; |
|
| 43 | + echo '<img class="redux-option-image" id="image_' . esc_attr( $this->field['id'] ) . '_' . esc_attr( $attachment_id ) . '" src="' . esc_url( $img[0] ) . '" alt="' . esc_attr( $alt ) . '" target="_blank" rel="external" />'; |
|
| 44 | + echo '</a>'; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - echo '</div>'; |
|
| 50 | - echo '<a href="#" onclick="return false;" id="edit-gallery" class="gallery-attachments button button-primary">' . esc_html__( 'Add/Edit Gallery', 'redux-framework' ) . '</a> '; |
|
| 51 | - echo '<a href="#" onclick="return false;" id="clear-gallery" class="gallery-attachments button">' . esc_html__( 'Clear Gallery', 'redux-framework' ) . '</a>'; |
|
| 52 | - echo '<input type="hidden" class="gallery_values ' . esc_attr( $this->field['class'] ) . '" value="' . esc_attr( $this->value ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" />'; |
|
| 53 | - } |
|
| 49 | + echo '</div>'; |
|
| 50 | + echo '<a href="#" onclick="return false;" id="edit-gallery" class="gallery-attachments button button-primary">' . esc_html__( 'Add/Edit Gallery', 'redux-framework' ) . '</a> '; |
|
| 51 | + echo '<a href="#" onclick="return false;" id="clear-gallery" class="gallery-attachments button">' . esc_html__( 'Clear Gallery', 'redux-framework' ) . '</a>'; |
|
| 52 | + echo '<input type="hidden" class="gallery_values ' . esc_attr( $this->field['class'] ) . '" value="' . esc_attr( $this->value ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" />'; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Enqueue Function. |
|
| 57 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 58 | - * |
|
| 59 | - * @since 1.0.0 |
|
| 60 | - * @access public |
|
| 61 | - * @return void |
|
| 62 | - */ |
|
| 63 | - public function enqueue() { |
|
| 55 | + /** |
|
| 56 | + * Enqueue Function. |
|
| 57 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 58 | + * |
|
| 59 | + * @since 1.0.0 |
|
| 60 | + * @access public |
|
| 61 | + * @return void |
|
| 62 | + */ |
|
| 63 | + public function enqueue() { |
|
| 64 | 64 | |
| 65 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
| 66 | - wp_enqueue_media(); |
|
| 67 | - } else { |
|
| 68 | - wp_enqueue_script( 'media-upload' ); |
|
| 69 | - wp_enqueue_script( 'thickbox' ); |
|
| 70 | - wp_enqueue_style( 'thickbox' ); |
|
| 71 | - } |
|
| 65 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
| 66 | + wp_enqueue_media(); |
|
| 67 | + } else { |
|
| 68 | + wp_enqueue_script( 'media-upload' ); |
|
| 69 | + wp_enqueue_script( 'thickbox' ); |
|
| 70 | + wp_enqueue_style( 'thickbox' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - wp_enqueue_script( |
|
| 74 | - 'redux-field-gallery', |
|
| 75 | - Redux_Core::$url . 'inc/fields/gallery/redux-gallery' . Redux_Functions::is_min() . '.js', |
|
| 76 | - array( 'jquery', 'redux-js' ), |
|
| 77 | - $this->timestamp, |
|
| 78 | - true |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - } |
|
| 73 | + wp_enqueue_script( |
|
| 74 | + 'redux-field-gallery', |
|
| 75 | + Redux_Core::$url . 'inc/fields/gallery/redux-gallery' . Redux_Functions::is_min() . '.js', |
|
| 76 | + array( 'jquery', 'redux-js' ), |
|
| 77 | + $this->timestamp, |
|
| 78 | + true |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | class_alias( 'Redux_Gallery', 'ReduxFramework_Gallery' ); |