ReduxFramework_gallery

Main ReduxFramework_gallery class.

Defined (1)

The class is defined in the following location(s).

/library/admin/redux-framework/inc/fields/gallery/field_gallery.php  
  1. class ReduxFramework_gallery { 
  2.  
  3. /** 
  4. * Field Constructor. 
  5. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function 
  6. * @since 1.0.0 
  7. * @access public 
  8. * @return void 
  9. */ 
  10. function __construct( $field = array(), $value = '', $parent ) { 
  11. $this->parent = $parent; 
  12. $this->field = $field; 
  13. $this->value = $value; 
  14.  
  15. /** 
  16. * Field Render Function. 
  17. * Takes the vars and outputs the HTML for the field in the settings 
  18. * @since 1.0.0 
  19. * @access public 
  20. * @return void 
  21. */ 
  22. public function render() { 
  23. echo '<div class="screenshot">'; 
  24.  
  25. if ( ! empty( $this->value ) ) { 
  26. $ids = explode( ', ', $this->value ); 
  27.  
  28. foreach ( $ids as $attachment_id ) { 
  29. $img = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); 
  30. echo '<a class="of-uploaded-image" href="' . $img[0] . '">'; 
  31. echo '<img class="redux-option-image" id="image_' . $this->field['id'] . '_' . $attachment_id . '" src="' . $img[0] . '" alt="" target="_blank" rel="external" />'; 
  32. echo '</a>'; 
  33.  
  34. echo '</div>'; 
  35. echo '<a href="#" onclick="return false;" id="edit-gallery" class="gallery-attachments button button-primary">' . __( 'Add/Edit Gallery', 'evolve' ) . '</a> '; 
  36. echo '<a href="#" onclick="return false;" id="clear-gallery" class="gallery-attachments button">' . __( 'Clear Gallery', 'evolve' ) . '</a>'; 
  37. echo '<input type="hidden" class="gallery_values ' . $this->field['class'] . '" value="' . esc_attr( $this->value ) . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '" />'; 
  38.  
  39. /** 
  40. * Enqueue Function. 
  41. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css 
  42. * @since 1.0.0 
  43. * @access public 
  44. * @return void 
  45. */ 
  46. public function enqueue() { 
  47.  
  48. if ( function_exists( 'wp_enqueue_media' ) ) { 
  49. wp_enqueue_media(); 
  50. } else { 
  51. wp_enqueue_script( 'media-upload' ); 
  52. wp_enqueue_script( 'thickbox' ); 
  53. wp_enqueue_style( 'thickbox' ); 
  54.  
  55. wp_enqueue_script( 
  56. 'redux-field-gallery-js',  
  57. ReduxFramework::$_url . 'inc/fields/gallery/field_gallery' . Redux_Functions::isMin() . '.js',  
  58. array( 'jquery', 'redux-js' ),  
  59. time(),  
  60. true 
  61. );